Stay organized with collections
Save and categorize content based on your preferences.
Request
open class Request
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 |
Ask the app to cancel this current request.
|
open String! |
Return the package name of the application that initiated the request.
|
open Int |
Return the uid of the application that initiated the request.
|
open Bundle! |
Return any additional extra information that was supplied as part of the request.
|
open Boolean |
Check whether this request is currently active.
|
open String |
|
Public methods
cancel
open fun cancel(): Unit
Ask the app to cancel this current request. This also finishes the request (it is no longer active).
getCallingPackage
open fun getCallingPackage(): String!
Return the package name of the application that initiated the request.
getCallingUid
open fun getCallingUid(): Int
Return the uid of the application that initiated the request.
open fun getExtras(): Bundle!
Return any additional extra information that was supplied as part of the request.
isActive
open fun isActive(): Boolean
Check whether this request is currently active. A request becomes inactive after calling cancel
or a final result method that completes the request. After this point, further interactions with the request will result in java.lang.IllegalStateException
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
open fun toString(): String
Return |
String |
a string representation of the object. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# VoiceInteractionSession.Request\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nRequest\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/service/voice/VoiceInteractionSession.Request \"View this page in Java\") \n\n```\nopen class Request\n```\n\n|---|------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.service.voice.VoiceInteractionSession.Request](#) |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [VoiceInteractionSession.AbortVoiceRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.AbortVoiceRequest), [VoiceInteractionSession.CommandRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.CommandRequest), [VoiceInteractionSession.CompleteVoiceRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.CompleteVoiceRequest), [VoiceInteractionSession.ConfirmationRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.ConfirmationRequest), [VoiceInteractionSession.PickOptionRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.PickOptionRequest) |--------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [VoiceInteractionSession.AbortVoiceRequest](/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](../../app/VoiceInteractor.AbortVoiceRequest.html#). | | [VoiceInteractionSession.CommandRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.CommandRequest) | A generic vendor-specific request, as per [VoiceInteractor.CommandRequest](../../app/VoiceInteractor.CommandRequest.html#). | | [VoiceInteractionSession.CompleteVoiceRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.CompleteVoiceRequest) | A request to simply inform the user that the voice operation has completed, as per [VoiceInteractor.CompleteVoiceRequest](../../app/VoiceInteractor.CompleteVoiceRequest.html#). | | [VoiceInteractionSession.ConfirmationRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.ConfirmationRequest) | A request for confirmation from the user of an operation, as per [VoiceInteractor.ConfirmationRequest](../../app/VoiceInteractor.ConfirmationRequest.html#). | | [VoiceInteractionSession.PickOptionRequest](/reference/kotlin/android/service/voice/VoiceInteractionSession.PickOptionRequest) | A request for the user to pick from a set of option, as per [VoiceInteractor.PickOptionRequest](../../app/VoiceInteractor.PickOptionRequest.html#). | |\n\nBase 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.\n\nSummary\n-------\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [cancel](#cancel())`()` Ask the app to cancel this current request. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getCallingPackage](#getCallingPackage())`()` Return the package name of the application that initiated the request. |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getCallingUid](#getCallingUid())`()` Return the uid of the application that initiated the request. |\n| open [Bundle](../../os/Bundle.html#)! | [getExtras](#getExtras())`()` Return any additional extra information that was supplied as part of the request. |\n| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isActive](#isActive())`()` Check whether this request is currently active. |\n| open [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [toString](#toString())`()` \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### cancel\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun cancel(): Unit\n```\n\nAsk the app to cancel this current request. This also finishes the request (it is no longer active). \n\n### getCallingPackage\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getCallingPackage(): String!\n```\n\nReturn the package name of the application that initiated the request. \n\n### getCallingUid\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getCallingUid(): Int\n```\n\nReturn the uid of the application that initiated the request. \n\n### getExtras\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getExtras(): Bundle!\n```\n\nReturn any additional extra information that was supplied as part of the request. \n\n### isActive\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun isActive(): Boolean\n```\n\nCheck whether this request is currently active. A request becomes inactive after calling [cancel](#cancel()) or a final result method that completes the request. After this point, further interactions with the request will result in [java.lang.IllegalStateException](../../../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. \n\n### toString\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun toString(): String\n```\n\n| Return ||\n|----------------------------------------------------------------------------------|----------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of the object. |"]]