Whether your app uses system or custom voice actions, there might be times when the app would like to ask the user a follow-up question before performing the action. For example when a user launches a music app by saying “play some music”, the app may want to ask the user “what genre?” Or when a home automation app hears the user say “OK Google, turn on the lights”, it might want to ask “which room?” The Voice Interaction API lets apps ask follow-up questions like these.
Getting follow-up user input
The Google Voice Interaction API lets an activity interact with the user using speech to get input that:
- confirms an action (for example, "are you sure?")
- selects from a list of options
Any activity can be designated as a voice interaction activity, letting it use the Voice Interaction API to get user input.
Verifying that an activity should complete
One use of follow-up input like "are you sure?" is to let the user verify incoming intents before completing an activity.
Your app doesn't know the source of the intent that started an activity, so it should confirm actions that can have more serious consequences. For example, viewing content generally has no side effects, but placing a call or sending an email should not be completed without user verification.
User verification for an action may be done by touching a confirmation on the screen, but sometimes this is not desirable — or the screen may be off. The Voice Interaction API lets an app get confirmation or selection input from the user by voice.
A voice interaction is a special kind of Android activity that is triggered by the user's voice to let them complete an action.