Added in API level 21

VoiceInteractionSessionService


abstract class VoiceInteractionSessionService : Service
kotlin.Any
   ↳ 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

Public methods
open IBinder?
onBind(intent: Intent!)

Return the communication channel to the service.

open Unit

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

open Unit

Called by the system when the service is first created.

open Unit

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

abstract VoiceInteractionSession!

open Unit
onTrimMemory(level: Int)

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
open Unit
dump(fd: FileDescriptor!, writer: PrintWriter!, args: Array<String!>!)

Print the Service's state into the given stream.

Inherited functions

Public constructors

VoiceInteractionSessionService

VoiceInteractionSessionService()

Public methods

onBind

Added in API level 21
open fun onBind(intent: Intent!): IBinder?

Return the communication channel to the service. May return null if clients can not bind to the service. The returned android.os.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 android.content.Context#bindService. Note that any extras that were included with the Intent at that point will not be seen here.
Return
IBinder? Return an IBinder through which clients can call on to the service.

onConfigurationChanged

Added in API level 21
open fun onConfigurationChanged(newConfig: Configuration): Unit

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
open fun onCreate(): Unit

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

onLowMemory

Added in API level 21
open fun onLowMemory(): Unit

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
abstract fun onNewSession(args: Bundle!): VoiceInteractionSession!

onTrimMemory

Added in API level 21
open fun onTrimMemory(level: Int): Unit

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 one of the following:

Protected methods

dump

Added in API level 21
protected open fun dump(
    fd: FileDescriptor!,
    writer: PrintWriter!,
    args: Array<String!>!
): Unit

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 Array<String!>!: additional arguments to the dump request.