Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
336 views
in Technique[技术] by (71.8m points)

android - How to handle ERROR_RECOGNIZER_BUSY

In my voice recognition based app, I sometimes receive ERROR_RECOGNIZER_BUSY. Intuitively, this calls for... retries, right?

The problem is that this error is very undocumented, so obviously I have questions that perhaps someone more experienced in the field is able to answer:

  1. What triggers such an error? Is it really only busy server (at Google)? or this could also hint at a bug in my app?
  2. Do I have to explicitly close/reopen a session before a retry?
  3. How often to retry? once every 1-second? every 5-seconds? Other?

Your experienced insights are most welcome. Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm not 100% sure of this, however since it's been so long since you posted, I may as well give it a shot. It seems that you are doing something wrong in the code. As the commenter said, it would be helpful if you actually posted the code that is returning this error. However, in the source code for the Android speech recognition service found here:

http://source-android.frandroid.com/frameworks/base/core/java/android/speech/RecognitionService.java we have a function called dispatchStopListening which seems to end the listening process. However, before it actually ends it, there are a few checks for illegal states, including this:

else if (mCurrentCallback.mListener.asBinder() != listener.asBinder()) {
            listener.onError(SpeechRecognizer.ERROR_RECOGNIZER_BUSY);
            Log.w(TAG, "stopListening called by other caller than startListening - ignoring");
        }

This seems to imply that you are trying to end the listening process by some other guy than you started it with, which raises this error. I hope this helps, but it would be extremely beneficial if you posted the code.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...