Voice Interaction API

Voice Interaction API

Slides used at my talk about Voice Interaction API during GDG HackFair Philippines 2015

57b162d778f0284d2dfe1dbaabd4434e?s=128

Jomar Tigcal

December 20, 2015
Tweet

Transcript

  1. Jomar Tigcal GDG HackFair Philippines 2015 Voice Interaction API

  2. 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 jomar@tigcal.com http://google.com/+JomarTigcal @jomartigcal
  3. 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
  4. Voice Interaction API

  5. Manifest configuration <activity android:name="org.example.MyVoiceActivity"> <intent-filter> <action android:name="org.example.MY_ACTION_INTENT" /> <category android:name="android.intent.category.DEFAULT"

    /> <category android:name="android.intent.category.VOICE" /> </intent-filter> </activity>
  6. build.gradle android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { minSdkVersion

    23 targetSdkVersion 23 } ….
  7. 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?
  8. 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); } … };
  9. Confirmation Request @Override public void onConfirmationResult( boolean confirmed, Bundle null)

    { if (confirmed) { doAction(); } finish(); }
  10. VoiceInteractor VoiceInteractor VoiceInteractor Activity.getVoiceInteractor ()

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

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

  13. 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
  14. Jomar Tigcal GDG HackFair Philippines 2015 Voice Interaction API