VoiceInteractionSessionService


public abstract class VoiceInteractionSessionService
extends Service

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


An active voice interaction session, initiated by a VoiceInteractionService.

Summary

Inherited constants

Public constructors

VoiceInteractionSessionService()

Public methods

IBinder onBind(Intent intent)

Return the communication channel to the service.

void onConfigurationChanged(Configuration newConfig)

Called by the system when the device configuration changes while your component is running.

void onCreate()

Called by the system when the service is first created.

void onLowMemory()

This is called when the overall system is running low on memory, and actively running processes should trim their memory usage.

abstract VoiceInteractionSession onNewSession(Bundle args)
void onTrimMemory(int level)

Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process.

Protected methods

void dump(FileDescriptor fd, PrintWriter writer, String[] args)

Print the Service's state into the given stream.

Inherited methods

Public constructors

VoiceInteractionSessionService

public VoiceInteractionSessionService ()

Public methods

onBind

Added in API level 21
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 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
IBinder Return an IBinder through which clients can call on to the service.

onConfigurationChanged

Added in API level 21
public void onConfigurationChanged (Configuration newConfig)

Called by the system when the device configuration changes while your component is running. Note that, unlike activities, other components are never restarted when a configuration changes: they must always deal with the results of the change, such as by re-retrieving resources.

At the time that this function has been called, your Resources object will have been updated to return resource values matching the new configuration.

For more information, read Handling Runtime Changes.

Parameters
newConfig Configuration: The new device configuration. This value cannot be null.

onCreate

Added in API level 21
public void onCreate ()

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

onLowMemory

Added in API level 21
public void onLowMemory ()

This is called when the overall system is running low on memory, and actively running processes should trim their memory usage. While the exact point at which this will be called is not defined, generally it will happen when all background process have been killed. That is, before reaching the point of killing processes hosting service and foreground UI that we would like to avoid killing.

onNewSession

Added in API level 21
public abstract VoiceInteractionSession onNewSession (Bundle args)

Parameters
args Bundle

Returns
VoiceInteractionSession

onTrimMemory

Added in API level 21
public void onTrimMemory (int level)

Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process. You should never compare to exact values of the level, since new intermediate values may be added -- you will typically want to compare if the value is greater or equal to a level you are interested in.

To retrieve the processes current trim level at any point, you can use ActivityManager.getMyMemoryState(RunningAppProcessInfo).

Parameters
level int: The context of the trim, giving a hint of the amount of trimming the application may like to perform. Value is ComponentCallbacks2.TRIM_MEMORY_COMPLETE, ComponentCallbacks2.TRIM_MEMORY_MODERATE, ComponentCallbacks2.TRIM_MEMORY_BACKGROUND, ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN, ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL, ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW, or ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE

Protected methods

dump

Added in API level 21
protected void dump (FileDescriptor fd, 
                PrintWriter writer, 
                String[] args)

Print the Service's state into the given stream. This gets invoked if you run "adb shell dumpsys activity service <yourservicename>" (note that for this command to work, the service must be running, and you must specify a fully-qualified service name). This is distinct from "dumpsys <servicename>", which only works for named system services and which invokes the IBinder#dump method on the IBinder interface registered with ServiceManager.

Parameters
fd FileDescriptor: The raw file descriptor that the dump is being sent to.

writer PrintWriter: The PrintWriter to which you should dump your state. This will be closed for you after you return.

args String: additional arguments to the dump request.