Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

android - Can I keep the speech recognizer listening indefinitely?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...