WebViewer
WebViewer

Reputation: 811

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

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?

Upvotes: 1

Views: 117

Answers (1)

Jay Souper
Jay Souper

Reputation: 2646

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).

Upvotes: 2

Related Questions