Android APIs
public class

VoiceInteractor

extends Object
java.lang.Object
   ↳ android.app.VoiceInteractor

Class Overview

Interface for an Activity to interact with the user through voice. Use Activity.getVoiceInteractor to retrieve the interface, if the activity is currently involved in a voice interaction.

The voice interactor revolves around submitting voice interaction requests to the back-end voice interaction service that is working with the user. These requests are submitted with submitRequest(VoiceInteractor.Request), providing a new instance of a VoiceInteractor.Request subclass describing the type of operation to perform -- currently the possible requests are VoiceInteractor.ConfirmationRequest and VoiceInteractor.CommandRequest.

Once a request is submitted, the voice system will process it and eventually deliver the result to the request object. The application can cancel a pending request at any time.

The VoiceInteractor is integrated with Activity's state saving mechanism, so that if an activity is being restarted with retained state, it will retain the current VoiceInteractor and any outstanding requests. Because of this, you should always use Request.getActivity to get back to the activity of a request, rather than holding on to the activity instance yourself, either explicitly or implicitly through a non-static inner class.

Summary

Nested Classes
class VoiceInteractor.AbortVoiceRequest  
class VoiceInteractor.CommandRequest  
class VoiceInteractor.ConfirmationRequest  
class VoiceInteractor.Request  
Public Methods
boolean submitRequest(VoiceInteractor.Request request)
boolean[] supportsCommands(String[] commands)
Queries the supported commands available from the VoiceinteractionService.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public boolean submitRequest (VoiceInteractor.Request request)

public boolean[] supportsCommands (String[] commands)

Queries the supported commands available from the VoiceinteractionService. The command is a string that describes the generic operation to be performed. An example might be "com.google.voice.commands.REQUEST_NUMBER_BAGS" to request the number of bags as part of airline check-in. (This is not an actual working example.)