Voice interactions
Voice interactions usually originate from user voice action. However, the voice interaction activity starts without any user input. Android Marshmallow has a new voice interaction API that, together with
voice actions, allows us to build conversational voice experiences into our apps. Use the isVoiceInteraction()
method to determine whether an activity is triggered by a voice action. Then, you can use the VoiceInteractor
class and interact with the user.
Don't get confused with the isVoiceInteractionRoot()
method, which returns true
only if the activity is also the root of a voice interaction. Here, you will get true
if your activity was started directly by the voice interaction service and not by another activity (another app) while undergoing voice interaction.
A best practice would be to prompt the users and confirm that this is their intended action. You already know that voice input is invoked from Google Now, where you can open URLs with a simple voice input, such...