简体   繁体   中英

Error code 8 in android speech recognition on Nexus 7 tablet

I am trying to build an android app and it is working fine on Samsung galaxy S3 even in stress testing , like pressing microphone image button repeatedly

But I am having Error8 on my nexus7 tablet in the same stress testing microphone like pressing repeatedly ,after that app needs to be restarted in order to work properly For normal usage it is working fine in nexus7 too.

Below code is recognition class;

public class MyRecognitionListener implements RecognitionListener 

This is how i call speech recognition;

Intent recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getPackageName());
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, langParam);
        //recognizerIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,10);

        try {
            recognizer.startListening(recognizerIntent);
        } catch (Exception e) {

            recognizer.stopListening();
            e.printStackTrace();
        }

I would appreciate any help or clue

Best Regards

Error 8 is ERROR_RECOGNIZER_BUSY which may occur when the recognizer has too many requests or some other weird issue.

Here's some pseudocode that should work. I'm not too sure of your implementation, but if you do some overriding:

onError(int e) {
  if(e == 8) {
    mRecognitionListener.cancel();
    mRecognitionListener.startListening();
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM