Android SpeechRecognizer when do I get ERROR_CLIENT when starting the voice recognizer?

╄→гoц情女王★ 提交于 2021-01-27 12:00:53

问题


I am not sure about some documentation related stuff.

To sum up what I did and what I want to to: I managed to introduce voice recognition feature into an Android application that is running on Android 4.2 on a tablet, and it works ok. Now I want to port my application on Google Glass but unfortunately I get the following error when I try to start the speech recognizer: error 5 -> ERROR_CLIENT(Other client side errors). The message guides me to find other errors that not related to SpeechRecognizer object, but I don't get any in my logs, not even warnings. So my question would be: When exactly do I get ERROR_CLIENT? and what should look the errors that block the recognizer to start?

Thank you! :)


回答1:


So after a bit of pain I manage to solve my problem regarding my glass application.

First of all I found that SpeechRecognizer only works when my glasses are connected to the internet! Even so I still received from times to times ERROR 5. That was because I have a bad connectivity to the internet and from times to times my glass just disconnected from the internet without any notifications! I think this is an issue that must be solved for the next level of glasses. It just cannot disconnect from the internet without notifying you.

So one of the causes for ERROR_CLIENT(5) on Google Glass is: not having internet connection




回答2:


I found this link that is the source code for producing the errors.

SpeechRecognizer source

There are 7 places where a search found "ERROR_CLIENT"

Here's the log statements right before the ERROR_CLIENT is sent to onError

  • Log.e(TAG, "no selected voice recognition service");
  • Log.e(TAG, "bind to recognition service failed");
  • Log.e(TAG, "startListening() failed", e);
  • Log.e(TAG, "stopListening() failed", e);
  • Log.e(TAG, "cancel() failed", e);
  • Log.e(TAG, "not connected to the recognition service");

Of course you can find more info at the above link, but this should give you the general reasons why you'd get ERROR_CLIENT



来源:https://stackoverflow.com/questions/24995565/android-speechrecognizer-when-do-i-get-error-client-when-starting-the-voice-reco

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