Slide 1

Slide 1 text

Jomar Tigcal GDG HackFair Philippines 2015 Voice Interaction API

Slide 2

Slide 2 text

Jomar Tigcal GDG Philippines Community Manager Android Developer, Trainer, and Consultant Have Android (and Android Wear) apps on Google Play Store http://jomar.tigcal.com [email protected] http://google.com/+JomarTigcal @jomartigcal

Slide 3

Slide 3 text

Voice Interaction API ● New in Marshmallow (23+) ● Enables apps to interact with users via voice ● Confirm actions and select from a list of options using user’s voice

Slide 4

Slide 4 text

Voice Interaction API

Slide 5

Slide 5 text

Manifest configuration

Slide 6

Slide 6 text

build.gradle android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { minSdkVersion 23 targetSdkVersion 23 } ….

Slide 7

Slide 7 text

Handle Voice Interaction boolean Activity.isVoiceInteraction() Is activity running as part of a voice interaction with the user? boolean Activity.isVoiceInteractionRoot() Was activity started directly by a user’s voice action in the Google Search App?

Slide 8

Slide 8 text

Confirmation Request class Confirm extends VoiceInteractor.ConfirmationRequest { public Confirm(String ttsPrompt, String visualPrompt) { VoiceInteractor.Prompt prompt = new VoiceInteractor.Prompt( new String[] {ttsPrompt}, visualPrompt); super(prompt, null); } … };

Slide 9

Slide 9 text

Confirmation Request @Override public void onConfirmationResult( boolean confirmed, Bundle null) { if (confirmed) { doAction(); } finish(); }

Slide 10

Slide 10 text

VoiceInteractor VoiceInteractor VoiceInteractor Activity.getVoiceInteractor ()

Slide 11

Slide 11 text

VoiceInteractor VoiceInteractor.submitRequest(VoiceInteractor.Request) ❖ VoiceInteractor.ConfirmationRequest ❖ VoiceInteractor.PickOptionRequest ❖ VoiceInteractor.CompleteVoiceRequest ❖ VoiceInteractor.AbortVoiceRequest ❖ VoiceInteractor.CommandRequest.

Slide 12

Slide 12 text

Questions? Image Source: http://www.talkandroid.com/35960-google-test-market-accidentally-released-reviewed-quickly-pulled/

Slide 13

Slide 13 text

Thank you! Try the code lab at https://code-labs.io/codelabs/voice-interaction/ Learn more at https://developers.google.com/voice-actions/interaction Build something awesome! Provide feedback: talkback.tigcal.com

Slide 14

Slide 14 text

Jomar Tigcal GDG HackFair Philippines 2015 Voice Interaction API