Why the SpeechRecognizer is busy when I start it after the onEndOfSpeech has been called?

Viewed 675

I am developing in Android and use SpeechRecognizer to implement continuous speech recognition.

After start speech recognition via following code:

private void startListening(){
    recognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE, "en");
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE, getActivity().getPackageName());
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS,Long.valueOf(3000L));
    recognizerIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,1);
}

And call startListening() again when onEndOfSpeech has been called.

But the onError will been called , and show SpeechRecognizer.ERROR_RECOGNIZER_BUSY.

Q1: Why the SpeechRecognizer is busy when I start it after the onEndOfSpeech has been called?

Q2 How to implement the crooect way of continuous speech recognition ?

1 Answers
Related