Can I keep the speech recognizer listening indefinitely?
android
Solution
The `Android Speech recognizer` can be customized through the intent extra data. See the android documentation.
public static final String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
The amount of time that it should take after we stop hearing speech to consider the input complete. [...]
public static final String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS Since: API Level 8
The minimum length of an utterance. We will not stop recording before this amount of time. [...]
public static final String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS
The amount of time that it should take after we stop hearing speech to consider the input possibly complete. [...]
Set the EXTRA_LANGUAGE_MODEL to websearch to capture only relevant words.
Problem
When I call the `startListening` method of a `SpeechRecognizer` object, the speech recognizer starts listening for speech. I would like to create a service that is waiting for speech of a specific keyword: when the user says this keyword and the speech recognizer detects this keyword, then the service becomes ready to receive user voice commands. To this end, after a new `SpeechRecognizer` instantiated, I should call its `startListening` method: can I keep the speech recognizer listening indefinitely?