问题
I developed an app using the Android 4.1.2 and speech to text is working well but when I tried it on the Google Glass it is not working(Activity not found exception). This is my Speech to text Code
Intent intent = new Intent(
RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");
try {
startActivityForResult(intent, requestCode);
} catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
"Opps! Your device doesn't support Speech to Text",
Toast.LENGTH_SHORT);
}
I tried to install the Speech Synthesis apk manually but when I tried to start the speech synthesis app crashed. Is there a way to install the speech synthasizer or is there a workaround code for the speech to text to work in the Google Glass?
回答1:
To use the standard android speech recognition you have to install/deploy the com.google.android.voicesearch apk package (the version of Voicesearch.apk must be the one that came with the Android 4.0 or later, it did not work with the older version of the Voicesearch.apks)
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.
Updated : After Google Glass is Updated to XE9 you dont have to install the Voice Apk. The default one works fine. To uninstall the Voice Search Use the following command
adb uninstall com.google.android.voicesearch
来源:https://stackoverflow.com/questions/18073695/how-to-install-speech-to-text-in-google-glass