Search code examples
androidspeech

Automatically Timeout RecognizerIntent


I am playing around with Android's speech recognition and would like to be able to timeout the voice recognition intent. I am creating and starting the speech recognition intent, based on the Android API example code, and it works fine. What I would like is the ability to to automatically cancel/timeout the speech detection if there is no audio input after N milli seconds. In otherwords, listen for speech and if there is none after a short time return to the activity that started the intent. Is this possible? I looked at the documentation for RecognizerIntent and there were no extra fields for the intent for doing this.


Solution

  • One thing that comes to mind is that you set up a Post Delayed Handler. This handler will wait x seconds and then cancel the RecognizerIntent if time runs out and it is still up.