9

From name alone, I can derive that stopListening() is the opposite of startListening().

I can also understand that destroy() is the opposite of createSpeechRecognizer().

But cancel()... is the opposite of what?

All I could find in the documentation about it is:

Cancels the speech recognition.

How is cancel() different from stopListening()?

srf
  • 2,410
  • 4
  • 28
  • 41

1 Answers1

6

Well, you cancel the SpeechRecognition, i.e. I would assume there is no result handed back to you, whereas on stopListening() you just tell the recognizer that you are done with speaking and it should do the actual recognition now (and can close the microphone). Often, you don't need to call the stopListening() yourself as the end of speech is automatically determined (automatic endpointing).

Stephan
  • 7,360
  • 37
  • 46
  • So if I understand you correctly, stopListening() will always result in onResults() being called whereas cancel() will not? Thanks & +1. – srf Apr 21 '11 at 13:30
  • @srf onError() might be called as well, I guess ;) Actually, it's quite a bit since I played with that API, before I started to use the RECOGNIZE_SPEECH intents, so if the above written does not hold, I'd happy to hear about that. – Stephan Apr 21 '11 at 13:37