The standard Android SpeechRecognizer works fine on Google Glass XE16 - XE16.2.
Then, the XE17 update suddenly broke everything, with the following error and listener callbacks more:
E/AndroidRuntime(6321): FATAL EXCEPTION: main
E/AndroidRuntime(6321): Process: com.google.glass.voice, PID: 6321
E/AndroidRuntime(6321): java.lang.NullPointerException: VoiceEngine.startListening: voiceConfig cannot be null
E/AndroidRuntime(6321): at com.google.glass.predicates.Assert.assertNotNull(Assert.java:68)
E/AndroidRuntime(6321): at com.google.glass.voice.VoiceEngine.startListening(VoiceEngine.java:650)
E/AndroidRuntime(6321): at com.google.glass.voice.VoiceService$VoiceServiceBinder.startListening(VoiceService.java:116)
E/AndroidRuntime(6321): at com.google.glass.voice.GlassRecognitionService.attachCallback(GlassRecognitionService.java:272)
E/AndroidRuntime(6321): at com.google.glass.voice.GlassRecognitionService.onStartListening(GlassRecognitionService.java:216)
E/AndroidRuntime(6321): at android.speech.RecognitionService.dispatchStartListening(RecognitionService.java:98)
E/AndroidRuntime(6321): at android.speech.RecognitionService.access$000(RecognitionService.java:36)
E/AndroidRuntime(6321): at android.speech.RecognitionService$1.handleMessage(RecognitionService.java:79)
E/AndroidRuntime(6321): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(6321): at android.os.Looper.loop(Looper.java:149)
By parsing GlassVoice.apk (located in / system / priv-app /), I was able to find out that you can add these two add-ons to your SpeechRecognizer Intent and corrects the NullPointerException:
//mSpeechIntent.putExtra( GlassSpeechRecognizer.EXTRA_VOICE_CONFIG_NAME, "Toto");
mSpeechIntent.putExtra( "voiceConfigName", "Toto");
//mSpeechIntent.putExtra( GlassSpeechRecognizer.EXTRA_VOICE_COMMANDS, new String[]{"red","green","blue"} );
mSpeechIntent.putExtra( "extraVoiceCommands", new String[] {"red","green","blue"}); // Command phrases allowed!
The problem is that they move GlassVoice.apk in a confined space, that you cannot load any class from your application. I did not know how to get around this - if you know how it will be very useful!
, , , .
( "" , ):
I/RecognizerController(1818): attachVoiceInputCallback
W/RecognizerController(1818): queueingGrecoListener was null in attachVoiceInputCallback
...
I/VoiceEngine[20daf4b4](1818): Hotword recognizer triggered a recognition result
...
I/SavedAudioStorage(1818): Saved SavedAudioRecord [id=null, filename=/data/data/com.google.glass.voice/recorded_audio/20140508_171311_197.pcm, recognized=true, synced=false, timestamp=1399594400939, recognizedCommands=red:2000:2620, sampleRate=16000]
?
!
@pscholl, .
, @pscholl.
, GlassVoice-xe17.apk, , "64K-" Android. , , "640K MS-DOS", Android (Dalvik VM).
ProGuard , : , , .
, Dex, : https://github.com/mmin18/Dex65536.
, GlassVoice.apk com.google.common, Guava. Dex65536 APK ( , ), .
"pre-loader ", Dex ClassLoader. , ( ).
! , Glass Dev Team , - : -)