Using Android Speech Recognition APIs from Google Glass

筅森魡賤 提交于 2019-11-27 10:59:40

问题


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.


回答1:


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.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!