I'm working to adapt an existing Android application to run on Google Glass, as a proof of concept. I would like to use voice input in my application to replace some features that currently require touch input.
I can deploy my APK to Google Glass and run it without a problem (through ADB), but once it's running, neither Android speech recognition API I've tried works on Glass:
startActivityForResult(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH));
This results in an ActivityNotFoundException ("no activity found to handle intent") when running on Google Glass
SpeechRecognizer.IsRecognitionAvailable(context);
This always returns false on Google Glass.
I'm curious if anyone else has run into these issues or has any suggestions.
To use the standard android speech recognition you have to install/deploy the com.google.android.voicesearch apk package.
I don't know if there is an official way to get this. I just googled the apk file.
Just install it by using adb install < apk-file >
Then you should be able to use the voice recognition feature of android on your glass device.
Another way is to use the very cool features of google glass, e.g. to just say "okay glass" to activate the voice recognition.
But therefore you have to root your device and activate this so called lab-feature.
This side is a good starting point for the activation of lab features: glassxe
I have not tried it by myself but I am going to.
It should be noted that now RecognizerIntent.ACTION_RECOGNIZE_SPEECH
just works on Glass and does not require the com.google.android.voicesearch
package. If you have installed it, you should uninstall it and use the built-in support.
来源:https://stackoverflow.com/questions/17414251/using-android-speech-recognition-apis-from-google-glass