how to integrate app action using actions.xml?

2019-05-24 04:03发布

问题:

I am trying to build a build-in-intent[actions.intent.CHECK_AIR_QUALITY]. I have already added the actions.xml in my project. Here is the code:

<?xml version ="1.0" encoding ="utf-8"?><!--  Learn More about how to use 
App Actions: https://developer.android.com/guide/actions/index.html -->
<actions>
    <!--Example Action -->
    <action intentName="actions.intent.CHECK_AIR_QUALITY">
    <action-display
        label="Check quality"
        />
    <fulfillment urlTemplate="https://www.google.co.in/order{?drop}">
        <parameter-mapping
            intentParameter="drop"
            urlParameter="drop" />
    </fulfillment>
    </action>
</actions>

Here I put a sample url in the place of urlTemplate . But after I install the app in my device the below option(APP ACTION TEST TOOL) is not coming. Here is the video link where I have taken the screen shot.

So I do R&D on that and I have found some link for the conversational action of google codelabs.

Please let me know if you need more information.

回答1:

At Google I/O 2019, some updates were posted about App Actions. The menu item you're looking for is enabled by installing the App Actions Test Tool plugin which you can find in the Android Studio plugin marketplace by searching for "App Actions" (web link).

  • Official documentation
  • Google I/O 2019 session on App Actions (video)
  • Sample application on github