AlwaysOnHotwordDetector.Callback

public static abstract class AlwaysOnHotwordDetector.Callback
extends Object

java.lang.Object
   ↳ android.service.voice.AlwaysOnHotwordDetector.Callback


Callbacks for always-on hotword detection.

Summary

Public constructors

AlwaysOnHotwordDetector.Callback()

Public methods

abstract void onAvailabilityChanged(int status)

Called when the hotword availability changes.

abstract void onDetected(AlwaysOnHotwordDetector.EventPayload eventPayload)

Called when the keyphrase is spoken.

abstract void onError()

Called when the detection fails due to an error.

abstract void onRecognitionPaused()

Called when the recognition is paused temporarily for some reason.

abstract void onRecognitionResumed()

Called when the recognition is resumed after it was temporarily paused.

Inherited methods

Public constructors

AlwaysOnHotwordDetector.Callback

added in API level 21
AlwaysOnHotwordDetector.Callback ()

Public methods

onAvailabilityChanged

added in API level 21
void onAvailabilityChanged (int status)

Called when the hotword availability changes. This indicates a change in the availability of recognition for the given keyphrase. It's called at least once with the initial availability.

Availability implies whether the hardware on this system is capable of listening for the given keyphrase or not.

Parameters
status int

onDetected

added in API level 21
void onDetected (AlwaysOnHotwordDetector.EventPayload eventPayload)

Called when the keyphrase is spoken. This implicitly stops listening for the keyphrase once it's detected. Clients should start a recognition again once they are done handling this detection.

Parameters
eventPayload AlwaysOnHotwordDetector.EventPayload: Payload data for the detection event. This may contain the trigger audio, if requested when calling startRecognition(int).

This value must never be null.

onError

added in API level 21
void onError ()

Called when the detection fails due to an error.

onRecognitionPaused

added in API level 21
void onRecognitionPaused ()

Called when the recognition is paused temporarily for some reason. This is an informational callback, and the clients shouldn't be doing anything here except showing an indication on their UI if they have to.

onRecognitionResumed

added in API level 21
void onRecognitionResumed ()

Called when the recognition is resumed after it was temporarily paused. This is an informational callback, and the clients shouldn't be doing anything here except showing an indication on their UI if they have to.