# VoiceInteractionSession.Request

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

# Request

*** ** * ** ***

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

```
open class 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#) |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [VoiceInteractionSession.AbortVoiceRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.AbortVoiceRequest),[VoiceInteractionSession.CommandRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.CommandRequest),[VoiceInteractionSession.CompleteVoiceRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.CompleteVoiceRequest),[VoiceInteractionSession.ConfirmationRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.ConfirmationRequest),[VoiceInteractionSession.PickOptionRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.PickOptionRequest) |-------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [VoiceInteractionSession.AbortVoiceRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.AbortVoiceRequest)       | A request to report that the current user interaction can not be completed with voice, as per[VoiceInteractor.AbortVoiceRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.AbortVoiceRequest.html#). | | [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#).                                                           | | [VoiceInteractionSession.CompleteVoiceRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.CompleteVoiceRequest) | A request to simply inform the user that the voice operation has completed, as per[VoiceInteractor.CompleteVoiceRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CompleteVoiceRequest.html#).      | | [VoiceInteractionSession.ConfirmationRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.ConfirmationRequest)   | A request for confirmation from the user of an operation, as per[VoiceInteractor.ConfirmationRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.ConfirmationRequest.html#).                          | | [VoiceInteractionSession.PickOptionRequest](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.PickOptionRequest)       | A request for the user to pick from a set of option, as per[VoiceInteractor.PickOptionRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.html#).                                   | |

Base class representing a request from a voice-driver app to perform a particular voice operation with the user. See related subclasses for the types of requests that are possible.

## Summary

|                                                                                                                                                  Public methods                                                                                                                                                  ||
|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[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())`()` Ask the app to cancel this current request.                                                  |
| open[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())`()` Return the package name of the application that initiated the request. |
| open[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())`()` Return the uid of the application that initiated the request.                  |
| open[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!  | [getExtras](https://developer.android.com/reference/kotlin/android/service/voice/VoiceInteractionSession.Request#getExtras())`()` Return any additional extra information that was supplied as part of the request.      |
| open[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())`()` Check whether this request is currently active.                                          |
| open[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

### cancel

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

```
open fun cancel(): Unit
```

Ask the app to cancel this current request. This also finishes the request (it is no longer active).  

### getCallingPackage

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

```
open fun getCallingPackage(): String!
```

Return the package name of the application that initiated the request.  

### getCallingUid

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

```
open fun getCallingUid(): Int
```

Return the uid of the application that initiated the request.  

### getExtras

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

```
open fun getExtras(): Bundle!
```

Return any additional extra information that was supplied as part of the request.  

### isActive

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

```
open fun isActive(): Boolean
```

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.  

### toString

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

```
open fun toString(): String
```

|                                                          Return                                                          ||
|----------------------------------------------------------------------------------|----------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |