Added in API level 23

ConfirmationRequest


class ConfirmationRequest : VoiceInteractor.Request

Confirms an operation with the user via the trusted system VoiceInteractionService. This allows an Activity to complete an unsafe operation that would require the user to touch the screen when voice interaction mode is not enabled. The result of the confirmation will be returned through an asynchronous call to either onConfirmationResult(boolean,android.os.Bundle) or onCancel() - these methods should be overridden to define the application specific behavior.

In some cases this may be a simple yes / no confirmation or the confirmation could include context information about how the action will be completed (e.g. booking a cab might include details about how long until the cab arrives) so the user can give a confirmation.

Summary

Public constructors

Create a new confirmation request.

Public methods
open Unit
onConfirmationResult(confirmed: Boolean, result: Bundle!)

Handle the confirmation result.

Inherited functions
Unit cancel()

Cancel this active request.

Activity! getActivity()

Return the current Activity this request is associated with. Will change if the activity is restarted such as through a configuration change.

Context! getContext()

Return the current Context this request is associated with. May change if the activity hosting it goes through a configuration change.

String! getName()

Return the name this request was submitted through submitRequest(android.app.VoiceInteractor.Request,java.lang.String).

Unit onAttached(activity: Activity!)

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

Unit onCancel()

Report from voice interaction service: this operation has been canceled, typically as a completion of a previous call to cancel or when the user explicitly cancelled.

Unit onDetached()

The request is being detached from an activity.

String toString()

Public constructors

ConfirmationRequest

Added in API level 23
ConfirmationRequest(
    prompt: VoiceInteractor.Prompt?,
    extras: Bundle?)

Create a new confirmation request.

Parameters
prompt VoiceInteractor.Prompt?: Optional confirmation to speak to the user or null if nothing should be spoken.
extras Bundle?: Additional optional information or null.

Public methods

onConfirmationResult

Added in API level 23
open fun onConfirmationResult(
    confirmed: Boolean,
    result: Bundle!
): Unit

Handle the confirmation result. Override this method to define the behavior when the user confirms or rejects the operation.

Parameters
confirmed Boolean: Whether the user confirmed or rejected the operation.
result Bundle!: Additional result information or null.