Android APIs
public class

VoiceInteractionService

extends Service
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.service.voice.VoiceInteractionService

Class Overview

Top-level service of the current global voice interactor, which is providing support for hotwording, the back-end of a VoiceInteractor, etc. The current VoiceInteractionService that has been selected by the user is kept always running by the system, to allow it to do things like listen for hotwords in the background to instigate voice interactions.

Because this service is always running, it should be kept as lightweight as possible. Heavy-weight operations (including showing UI) should be implemented in the associated VoiceInteractionSessionService when an actual voice interaction is taking place, and that service should run in a separate process from this one.

Summary

Constants
String SERVICE_INTERFACE The Intent that must be declared as handled by the service.
String SERVICE_META_DATA Name under which a VoiceInteractionService component publishes information about itself.
[Expand]
Inherited Constants
From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2
Public Constructors
VoiceInteractionService()
Public Methods
IBinder onBind(Intent intent)
Return the communication channel to the service.
void onCreate()
Called by the system when the service is first created.
void startSession(Bundle args)
[Expand]
Inherited Methods
From class android.app.Service
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2

Constants

public static final String SERVICE_INTERFACE

The Intent that must be declared as handled by the service. To be supported, the service must also require the BIND_VOICE_INTERACTION permission so that other applications can not abuse it.

Constant Value: "android.service.voice.VoiceInteractionService"

public static final String SERVICE_META_DATA

Name under which a VoiceInteractionService component publishes information about itself. This meta-data should reference an XML resource containing a <voice-interaction-service> tag.

Constant Value: "android.voice_interaction"

Public Constructors

public VoiceInteractionService ()

Public Methods

public IBinder onBind (Intent intent)

Return the communication channel to the service. May return null if clients can not bind to the service. The returned IBinder is usually for a complex interface that has been described using aidl.

Note that unlike other application components, calls on to the IBinder interface returned here may not happen on the main thread of the process. More information about the main thread can be found in Processes and Threads.

Parameters
intent The Intent that was used to bind to this service, as given to Context.bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Returns
  • Return an IBinder through which clients can call on to the service.

public void onCreate ()

Called by the system when the service is first created. Do not call this method directly.

public void startSession (Bundle args)