In my app's Logcat, I noticed that SpeechRecognizer
's onBeginningOfSpeech() is sometimes called after SpeechRecognizer.cancel().
Assuming this is not a SpeechRecognizer
bug, in what circumstances this should or could happen?
Is there a delay between cancel() and actual shutdown of the listener?
The
onBeginningOfSpeech()
callback is called when the speech recognizer starts detecting speech in the audio stream being processed by it.The
cancel()
method cancels any in-progress speech recognition, so onBeginningOfSpeech() should never occur after cancel() is called.Most likely, there is a bug in your code that results in delay in the cancellation process.
Also, check very carefully that the
onBegninningOfSpeech()
you are seeing aftercancel()
does not belong to a previous recognizer start (incorrectly followed by another recognizer start, beforeonEndOfSpeech()
oronError()
arrived).