Added in API level 23

CommandRequest


class CommandRequest : VoiceInteractionSession.Request

A generic vendor-specific request, as per VoiceInteractor.CommandRequest.

Summary

Public methods
String!

Return the command that is being executed, as per VoiceInteractor.CommandRequest.

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 with false for isCompleted.

Unit
sendResult(result: Bundle!)

Report the final result of the request, completing the request and resulting in a call to VoiceInteractor.CommandRequest.onCommandResult with true for isCompleted.

Inherited functions
Unit cancel()

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

String! getCallingPackage()

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

Int getCallingUid()

Return the uid of the application that initiated the request.

Bundle! getExtras()

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

Boolean isActive()

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.

String toString()

Public methods

getCommand

Added in API level 23
fun getCommand(): String!

Return the command that is being executed, as per VoiceInteractor.CommandRequest.

sendIntermediateResult

Added in API level 23
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 with false for isCompleted.

sendResult

Added in API level 23
fun sendResult(result: Bundle!): Unit

Report the final result of the request, completing the request and resulting in a call to VoiceInteractor.CommandRequest.onCommandResult with true for isCompleted. This finishes the request (it is no longer active).