Introduction
Android provides two ways for me to use speech recognition.
The first way is by an Intent
, as in this question: Intent example. A new Activity
is pushed onto the top of the stack which listens to the user, hears some speech, attempts to transcribes it (normally via the cloud) then returns the result to my app, via an onActivityResult
call.
The second is by getting a SpeechRecognizer
, like the code here: SpeechRecognizer example. Here, it looks like the speech is recorded and transcribed on some other thread, then callbacks bring me the results. And this is done without leaving my Activity
.
I would like to understand the pros and cons of these two ways of doing speech recognition.
What I've got so far
Using the Intent
:
- is simple to code
- avoids reinventing the wheel
- gives consistent user experience of speech recognition across the device
but
- might be slow for the creation of a new activity with it's own window
Using the SpeechRecognizer
:
- lets me retain control of UI in my app
- gives me extra possibilities of things to respond to (documentation)
but
- is limited to be called from the main thread
- more control requires more error-checking.