VoiceInteractionManager


public final class VoiceInteractionManager
extends Object

java.lang.Object
   ↳ android.app.voiceinteraction.VoiceInteractionManager


Service that provides information about and interacts with the current global voice interactor

Summary

Constants

int READ_SCREEN_CONTEXT_REQUEST_STATE_GRANTED

Read screen context access is granted.

int READ_SCREEN_CONTEXT_REQUEST_STATE_REQUESTABLE

Read screen context access isn't granted, but apps can request access.

int READ_SCREEN_CONTEXT_REQUEST_STATE_UNREQUESTABLE

Read screen context access is denied, and can't be requested with dialog by apps.

Public methods

boolean canReadScreenContext()

Returns whether the calling app can read screen context.

Intent createRequestReadScreenContextIntent()

Creates an intent which can be used to request access to screen context for current assistant role holder.

int getReadScreenContextRequestState()

Returns the read screen context request state for an app.

Inherited methods

Constants

READ_SCREEN_CONTEXT_REQUEST_STATE_GRANTED

Added in API level 37
public static final int READ_SCREEN_CONTEXT_REQUEST_STATE_GRANTED

Read screen context access is granted.

Constant Value: 0 (0x00000000)

READ_SCREEN_CONTEXT_REQUEST_STATE_REQUESTABLE

Added in API level 37
public static final int READ_SCREEN_CONTEXT_REQUEST_STATE_REQUESTABLE

Read screen context access isn't granted, but apps can request access. When the app request access, user will be prompted with request dialog to grant or deny the request.

Constant Value: 1 (0x00000001)

READ_SCREEN_CONTEXT_REQUEST_STATE_UNREQUESTABLE

Added in API level 37
public static final int READ_SCREEN_CONTEXT_REQUEST_STATE_UNREQUESTABLE

Read screen context access is denied, and can't be requested with dialog by apps. Access request will be automatically denied by the system, preventing the request dialog from being displayed to the user.

Constant Value: 2 (0x00000002)

Public methods

canReadScreenContext

Added in API level 37
public boolean canReadScreenContext ()

Returns whether the calling app can read screen context.

Returns
boolean true if the calling app is the current assistant and has access to screen context , false otherwise.

createRequestReadScreenContextIntent

Added in API level 37
public Intent createRequestReadScreenContextIntent ()

Creates an intent which can be used to request access to screen context for current assistant role holder. This intent MUST be used with Activity.startActivityForResult(Intent, int). The result code of the activity will be Activity.RESULT_OK if the request was granted, Activity.RESULT_CANCELED if not. If the caller is not the current default assistant, the request will be denied automatically.

Returns
Intent The created intent.
This value cannot be null.

getReadScreenContextRequestState

Added in API level 37
public int getReadScreenContextRequestState ()

Returns the read screen context request state for an app. This method provides a streamlined mechanism for applications to determine whether read screen context access can be requested (i.e. whether the user will be prompted with a request dialog).

Returns
int The current request state of the specified access, represented by one of the following constants: READ_SCREEN_CONTEXT_REQUEST_STATE_GRANTED, READ_SCREEN_CONTEXT_REQUEST_STATE_REQUESTABLE, or READ_SCREEN_CONTEXT_REQUEST_STATE_UNREQUESTABLE
Value is one of the following: