# VoiceInteractor.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/app/VoiceInteractor.Request "View this page in Java")  

```
abstract class Request
```

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

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known Direct Subclasses [VoiceInteractor.AbortVoiceRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.AbortVoiceRequest),[VoiceInteractor.CommandRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest),[VoiceInteractor.CompleteVoiceRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CompleteVoiceRequest),[VoiceInteractor.ConfirmationRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.ConfirmationRequest),[VoiceInteractor.PickOptionRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest) |-----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------| | [VoiceInteractor.AbortVoiceRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.AbortVoiceRequest)       | Reports that the current interaction can not be complete with voice, so the application will need to switch to a traditional input UI.  | | [VoiceInteractor.CommandRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CommandRequest)             | Execute a vendor-specific command using the trusted system VoiceInteractionService.                                                     | | [VoiceInteractor.CompleteVoiceRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.CompleteVoiceRequest) | Reports that the current interaction was successfully completed with voice, so the application can report the final status to the user. | | [VoiceInteractor.ConfirmationRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.ConfirmationRequest)   | Confirms an operation with the user via the trusted system VoiceInteractionService.                                                     | | [VoiceInteractor.PickOptionRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest)       | Select a single option from multiple potential options with the user via the trusted system VoiceInteractionService.                    | |

Base class for voice interaction requests that can be submitted to the interactor. Do not instantiate this directly -- instead, use the appropriate subclass.

## Summary

|                                                                                                                                                                                                                                   Public methods                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [cancel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#cancel())`()` Cancel this active request.                                                                                                                                                                                                                                                |
| open[Activity](https://developer.android.com/reference/kotlin/android/app/Activity)!         | [getActivity](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#getActivity())`()` Return the current[Activity](https://developer.android.com/reference/kotlin/android/app/Activity)this request is associated with.                                                                                                                                |
| open[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)! | [getContext](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#getContext())`()` Return the current[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)this request is associated with.                                                                                                                          |
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!        | [getName](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#getName())`()` Return the name this request was submitted through[submitRequest(android.app.VoiceInteractor.Request,java.lang.String)](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor#submitRequest(android.app.VoiceInteractor.Request,%20kotlin.String)). |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [onAttached](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#onAttached(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity)!`)` The request is now attached to an activity, or being re-attached to a new activity after a configuration change.                                 |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [onCancel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#onCancel())`()` Report from voice interaction service: this operation has been canceled, typically as a completion of a previous call to[cancel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#cancel())or when the user explicitly cancelled.    |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [onDetached](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#onDetached())`()` The request is being detached from an activity.                                                                                                                                                                                                                    |
| open[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)         | [toString](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.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
```

Cancel this active request.  

### getActivity

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

```
open fun getActivity(): Activity!
```

Return the current[Activity](https://developer.android.com/reference/kotlin/android/app/Activity)this request is associated with. Will change if the activity is restarted such as through a configuration change.  

### getContext

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

```
open fun getContext(): Context!
```

Return the current[Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)this request is associated with. May change if the activity hosting it goes through a configuration change.  

### getName

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

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

Return the name this request was submitted through[submitRequest(android.app.VoiceInteractor.Request,java.lang.String)](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor#submitRequest(android.app.VoiceInteractor.Request,%20kotlin.String)).  

### onAttached

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

```
open fun onAttached(activity: Activity!): Unit
```

The request is now attached to an activity, or being re-attached to a new activity after a configuration change.  

### onCancel

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

```
open fun onCancel(): Unit
```

Report from voice interaction service: this operation has been canceled, typically as a completion of a previous call to[cancel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#cancel())or when the user explicitly cancelled.  

### onDetached

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

```
open fun onDetached(): Unit
```

The request is being detached from an activity.  

### 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. |