SpeechRecognizer onBeginningOfSpeech() **after** cancel()

102 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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 after cancel() does not belong to a previous recognizer start (incorrectly followed by another recognizer start, before onEndOfSpeech() or onError() arrived).