Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Voice Interaction API

Voice Interaction API

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

Jomar Tigcal

December 20, 2015
Tweet

More Decks by Jomar Tigcal

Other Decks in Technology

Transcript

  1. Jomar Tigcal
    GDG HackFair Philippines 2015
    Voice Interaction API

    View full-size slide

  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
    [email protected]
    http://google.com/+JomarTigcal
    @jomartigcal

    View full-size slide

  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

    View full-size slide

  4. Voice Interaction API

    View full-size slide

  5. Manifest configuration







    View full-size slide

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

    View full-size slide

  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?

    View full-size slide

  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);
    }

    };

    View full-size slide

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

    View full-size slide

  10. VoiceInteractor
    VoiceInteractor
    VoiceInteractor Activity.getVoiceInteractor ()

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  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

    View full-size slide

  14. Jomar Tigcal
    GDG HackFair Philippines 2015
    Voice Interaction API

    View full-size slide