# VoiceInteractionSession.CommandRequest

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

# CommandRequest

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/service/voice/VoiceInteractionSession.CommandRequest "View this page in Java")  

```
class CommandRequest : VoiceInteractionSession.Request
```

|---|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                                  |||
| ↳ | [android.service.voice.VoiceInteractionSession.Request](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request)                   ||
|   | ↳ | [android.service.voice.VoiceInteractionSession.CommandRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.CommandRequest#) |

A generic vendor-specific request, as per[VoiceInteractor.CommandRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest.html#).

## Summary

|                                                                                                                                                                                                                                                                                                                                                                              Public methods                                                                                                                                                                                                                                                                                                                                                                               ||
|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getCommand](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.CommandRequest#getCommand())`()` Return the command that is being executed, as per[VoiceInteractor.CommandRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest.html#).                                                                                                                                                                                                                                                                                                                                                         |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)      | [sendIntermediateResult](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.CommandRequest#sendIntermediateResult(android.os.Bundle))`(`result:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` Report an intermediate result of the request, without completing it (the request is still active and the app is waiting for the final result), resulting in a call to[VoiceInteractor.CommandRequest.onCommandResult](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest.html#onCommandResult(kotlin.Boolean,%20android.os.Bundle))with false for isCompleted. |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)      | [sendResult](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.CommandRequest#sendResult(android.os.Bundle))`(`result:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` Report the final result of the request, completing the request and resulting in a call to[VoiceInteractor.CommandRequest.onCommandResult](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest.html#onCommandResult(kotlin.Boolean,%20android.os.Bundle))with true for isCompleted.                                                                                                      |

| Inherited functions ||
|---|---|
| From class[Request](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request) |------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [cancel](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#cancel())`()` <br /> Ask the app to cancel this current request. This also finishes the request (it is no longer active). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!  | [getCallingPackage](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#getCallingPackage())`()` <br /> Return the package name of the application that initiated the request. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)         | [getCallingUid](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#getCallingUid())`()` <br /> Return the uid of the application that initiated the request. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!  | [getExtras](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#getExtras())`()` <br /> Return any additional extra information that was supplied as part of the request. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isActive](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#isActive())`()` <br /> Check whether this request is currently active. A request becomes inactive after calling[cancel](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#cancel())or a final result method that completes the request. After this point, further interactions with the request will result in[java.lang.IllegalStateException](https://developer.android.com/reference/kotlin/java/lang/IllegalStateException.html#)errors; you should not catch these errors, but can use this method if you need to determine the state of the request. Returns true if the request is still active. <br /> | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)   | [toString](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#toString())`()` <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | ||

## Public methods

### getCommand

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

```
fun getCommand(): String!
```

Return the command that is being executed, as per[VoiceInteractor.CommandRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest.html#).  

### sendIntermediateResult

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

```
fun sendIntermediateResult(result: Bundle!): Unit
```

Report an intermediate result of the request, without completing it (the request is still active and the app is waiting for the final result), resulting in a call to[VoiceInteractor.CommandRequest.onCommandResult](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest.html#onCommandResult(kotlin.Boolean,%20android.os.Bundle))with false for isCompleted.  

### sendResult

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

```
fun sendResult(result: Bundle!): Unit
```

Report the final result of the request, completing the request and resulting in a call to[VoiceInteractor.CommandRequest.onCommandResult](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest.html#onCommandResult(kotlin.Boolean,%20android.os.Bundle))with true for isCompleted. This finishes the request (it is no longer active).