# CommandAction

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Inherited Constants](https://developer.android.com/reference/android/service/controls/actions/CommandAction#inhconstants)\|[Ctors](https://developer.android.com/reference/android/service/controls/actions/CommandAction#pubctors)\|[Methods](https://developer.android.com/reference/android/service/controls/actions/CommandAction#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/service/controls/actions/CommandAction#inhmethods)  

# CommandAction

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/service/controls/actions/CommandAction "View this page in Kotlin")\|Java

`
public

final

class
CommandAction
`  
`


``

extends `[ControlAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction)`


``


`

|---|---|------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.service.controls.actions.ControlAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction) ||
|   | ↳ | android.service.controls.actions.CommandAction |

<br />

*** ** * ** ***

A simple[ControlAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction)indicating that the user has interacted with a[Control](https://developer.android.com/reference/android/service/controls/Control)created using a[StatelessTemplate](https://developer.android.com/reference/android/service/controls/templates/StatelessTemplate).

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From class[android.service.controls.actions.ControlAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction) |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [RESPONSE_CHALLENGE_ACK](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK) Response code for the`consumer`in[ControlsProviderService.performControlAction](https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>))indicating that in order for the action to be performed, acknowledgment from the user is required.                                                                                                                                                                                                                                                                                                                                                                                   | | `int` | [RESPONSE_CHALLENGE_PASSPHRASE](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE) Response code for the`consumer`in[ControlsProviderService.performControlAction](https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>))indicating that in order for the action to be performed, an alphanumeric passphrase is required.                                                                                                                                                                                                                                                                                                                                                                       | | `int` | [RESPONSE_CHALLENGE_PIN](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN) Response code for the`consumer`in[ControlsProviderService.performControlAction](https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>))indicating that in order for the action to be performed, a PIN is required.                                                                                                                                                                                                                                                                                                                                                                                                          | | `int` | [RESPONSE_FAIL](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL) Response code for the`consumer`in[ControlsProviderService.performControlAction](https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>))indicating that the action has failed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | `int` | [RESPONSE_OK](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK) Response code for the`consumer`in[ControlsProviderService.performControlAction](https://developer.android.com/reference/android/service/controls/ControlsProviderService#performControlAction(java.lang.String,%20android.service.controls.actions.ControlAction,%20java.util.function.Consumer<java.lang.Integer>))indicating that the action has been performed.                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | `int` | [RESPONSE_UNKNOWN](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN) Value is[RESPONSE_UNKNOWN](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_UNKNOWN),[RESPONSE_OK](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_OK),[RESPONSE_FAIL](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_FAIL),[RESPONSE_CHALLENGE_ACK](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_ACK),[RESPONSE_CHALLENGE_PIN](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PIN), or[RESPONSE_CHALLENGE_PASSPHRASE](https://developer.android.com/reference/android/service/controls/actions/ControlAction#RESPONSE_CHALLENGE_PASSPHRASE) | | `int` | [TYPE_BOOLEAN](https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_BOOLEAN) The identifier of[BooleanAction](https://developer.android.com/reference/android/service/controls/actions/BooleanAction).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | `int` | [TYPE_COMMAND](https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND) The identifier of[CommandAction](https://developer.android.com/reference/android/service/controls/actions/CommandAction).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | `int` | [TYPE_ERROR](https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_ERROR) The identifier of the action returned by[getErrorAction()](https://developer.android.com/reference/android/service/controls/actions/ControlAction#getErrorAction()).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | `int` | [TYPE_FLOAT](https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_FLOAT) The identifier of[FloatAction](https://developer.android.com/reference/android/service/controls/actions/FloatAction).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | `int` | [TYPE_MODE](https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_MODE) The identifier of[ModeAction](https://developer.android.com/reference/android/service/controls/actions/ModeAction).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | |

|                                                                                                                                                          ### Public constructors                                                                                                                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[CommandAction](https://developer.android.com/reference/android/service/controls/actions/CommandAction#CommandAction(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` templateId) `                                                                                                          |
| ` `[CommandAction](https://developer.android.com/reference/android/service/controls/actions/CommandAction#CommandAction(java.lang.String,%20java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` templateId, `[String](https://developer.android.com/reference/java/lang/String)` challengeValue) ` |

|                                                                                 ### Public methods                                                                                  ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int` | ` `[getActionType](https://developer.android.com/reference/android/service/controls/actions/CommandAction#getActionType())`() ` The action type associated with this class. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.service.controls.actions.ControlAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction)` ` |-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`                                                                                                   | ` `[getActionType](https://developer.android.com/reference/android/service/controls/actions/ControlAction#getActionType())`() ` The action type associated with this class.                                                                                                                              | | ` `[String](https://developer.android.com/reference/java/lang/String)                                             | ` `[getChallengeValue](https://developer.android.com/reference/android/service/controls/actions/ControlAction#getChallengeValue())`() ` The challenge value used to authenticate certain actions, if available.                                                                                          | | ` static `[ControlAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction) | ` `[getErrorAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction#getErrorAction())`() ` Returns a singleton[ControlAction](https://developer.android.com/reference/android/service/controls/actions/ControlAction)used for indicating an error in unparceling. | | ` `[String](https://developer.android.com/reference/java/lang/String)                                             | ` `[getTemplateId](https://developer.android.com/reference/android/service/controls/actions/ControlAction#getTemplateId())`() ` The identifier of the[ControlTemplate](https://developer.android.com/reference/android/service/controls/templates/ControlTemplate)that originated this action            | | ` static final boolean`                                                                                           | ` `[isValidResponse](https://developer.android.com/reference/android/service/controls/actions/ControlAction#isValidResponse(int))`(int response) `                                                                                                                                                       | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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

### CommandAction

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

```
public CommandAction (String templateId)
```

<br />

<br />

|                                                                                                          Parameters                                                                                                           ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `templateId` | `String`: the identifier of the[StatelessTemplate](https://developer.android.com/reference/android/service/controls/templates/StatelessTemplate)that originated this action. This value cannot be`null`. <br /> |

### CommandAction

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

```
public CommandAction (String templateId, 
                String challengeValue)
```

<br />

<br />

|                                                                                                            Parameters                                                                                                             ||
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `templateId`     | `String`: the identifier of the[StatelessTemplate](https://developer.android.com/reference/android/service/controls/templates/StatelessTemplate)that originated this action. This value cannot be`null`. <br /> |
| `challengeValue` | `String`: a value sent by the user along with the action to authenticate.null is sent when no authentication is needed or has not been requested. <br />                                                        |

## Public methods

### getActionType

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

```
public int getActionType ()
```

The action type associated with this class.

<br />

|                                                                     Returns                                                                     ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [ControlAction.TYPE_COMMAND](https://developer.android.com/reference/android/service/controls/actions/ControlAction#TYPE_COMMAND) <br /> |