Partager via


SpeechRecognizer.StopListening Method

Definition

Stops listening for speech.

[Android.Runtime.Register("stopListening", "()V", "GetStopListeningHandler")]
public virtual void StopListening ();
[<Android.Runtime.Register("stopListening", "()V", "GetStopListeningHandler")>]
abstract member StopListening : unit -> unit
override this.StopListening : unit -> unit
Attributes

Remarks

Stops listening for speech. Speech captured so far will be recognized as if the user had stopped speaking at this point.

Note that in the default case, this does not need to be called, as the speech endpointer will automatically stop the recognizer listening when it determines speech has completed. However, you can manipulate endpointer parameters directly using the intent extras defined in RecognizerIntent, in which case you may sometimes want to manually call this method to stop listening sooner.

Upon invocation clients must wait until RecognitionListener#onResults or RecognitionListener#onError are invoked before calling SpeechRecognizer#startListening again. Otherwise such an attempt would be rejected by recognition service.

Please note that #setRecognitionListener(RecognitionListener) should be called beforehand, otherwise no notifications will be received.

Java documentation for android.speech.SpeechRecognizer.stopListening().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to