Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/app/VoiceInteractor.CommandRequest#pubctors) \| [Methods](https://developer.android.com/reference/android/app/VoiceInteractor.CommandRequest#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/VoiceInteractor.CommandRequest#inhmethods)

# VoiceInteractor.CommandRequest

*** ** * ** ***


`
public
static


class
VoiceInteractor.CommandRequest
`


`


`

`

extends https://developer.android.com/reference/android/app/VoiceInteractor.Request


`

`


`

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.app.VoiceInteractor.Request](https://developer.android.com/reference/android/app/VoiceInteractor.Request) ||
|   | ↳ | android.app.VoiceInteractor.CommandRequest |

<br />

*** ** * ** ***

Execute a vendor-specific command using the trusted system VoiceInteractionService.
This allows an Activity to request additional information from the user needed to
complete an action (e.g. booking a table might have several possible times that the
user could select from or an app might need the user to agree to a terms of service).
The result of the confirmation will be returned through an asynchronous call to
either `https://developer.android.com/reference/android/app/VoiceInteractor.CommandRequest#onCommandResult(boolean,%20android.os.Bundle)` or
`https://developer.android.com/reference/android/app/VoiceInteractor.Request#onCancel()`.

The command is a string that describes the generic operation to be performed.
The command will determine how the properties in extras are interpreted and the set of
available commands is expected to grow over time. An example might be
"com.google.voice.commands.REQUEST_NUMBER_BAGS" to request the number of bags as part of
airline check-in. (This is not an actual working example.)

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/VoiceInteractor.CommandRequest#CommandRequest(java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String command, https://developer.android.com/reference/android/os/Bundle args) ` Create a new generic command request. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/app/VoiceInteractor.CommandRequest#onCommandResult(boolean,%20android.os.Bundle)(boolean isCompleted, https://developer.android.com/reference/android/os/Bundle result) ` Results for CommandRequest can be returned in partial chunks. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/android/app/VoiceInteractor.Request ` |---|---| | ` void` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#cancel()() ` Cancel this active request. | | ` https://developer.android.com/reference/android/app/Activity` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#getActivity()() ` Return the current `https://developer.android.com/reference/android/app/Activity` this request is associated with. | | ` https://developer.android.com/reference/android/content/Context` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#getContext()() ` Return the current `https://developer.android.com/reference/android/content/Context` this request is associated with. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#getName()() ` Return the name this request was submitted through `https://developer.android.com/reference/android/app/VoiceInteractor#submitRequest(android.app.VoiceInteractor.Request,%20java.lang.String)`. | | ` void` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#onAttached(android.app.Activity)(https://developer.android.com/reference/android/app/Activity activity) ` The request is now attached to an activity, or being re-attached to a new activity after a configuration change. | | ` void` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#onCancel()() ` Report from voice interaction service: this operation has been canceled, typically as a completion of a previous call to `https://developer.android.com/reference/android/app/VoiceInteractor.Request#cancel()` or when the user explicitly cancelled. | | ` void` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#onDetached()() ` The request is being detached from an activity. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/app/VoiceInteractor.Request#toString()() ` Returns a string representation of the object. | ||
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### CommandRequest

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CommandRequest (String command, 
                Bundle args)
```

Create a new generic command request.

<br />

| Parameters ||
|---|---|
| `command` | `String`: The desired command to perform. <br /> |
| `args` | `Bundle`: Additional arguments to control execution of the command. <br /> |

## Public methods

### onCommandResult

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void onCommandResult (boolean isCompleted, 
                Bundle result)
```

Results for CommandRequest can be returned in partial chunks.
The isCompleted is set to true iff all results have been returned, indicating the
CommandRequest has completed.

<br />

| Parameters ||
|---|---|
| `isCompleted` | `boolean` <br /> |
| `result` | `Bundle` <br /> |