Updated 29 June 2019
App Actions feature lets the users launch a specific feature in your app using the Google Assistant. By enabling Android App Actions to extend your app, users can easily deep link into your apps via the Assistant by simply speaking a request to the Assistant. If the user has your app already installed, the Assistant triggers deep linking when users say an invocation phrase that includes your app name, such as ”Ok Google, order a pizza from the Pizza app”.
The Android operating system has provided some built-in actions for the ease of developers.
As an example we can see this :actions.intent.ORDER_MENU_ITEM
, an action to order something.
Similarly, we can check other actions as well.
To enable App Actions, you add an actions.xml file to your Android app project that tells Google what built-in intents your app supports.
Actions will run on devices back till Android 5 (API level 21). The recommended OS version is Android 8 (API level 26) or higher.
Create a new actions.xml
file in your res/xml
directory.
Here’s an example(to book a taxi) of an actions.xml
with an Action that is fulfilled using an App Links URL:
1 2 3 4 5 6 7 8 9 10 11 |
<?xml version="1.0" encoding="utf-8"?> <actions> <action intentName="actions.intent.CREATE_TAXI_RESERVATION" > <fulfillment urlTemplate="https://taxi-actions.firebaseapp.com/order{?dropoffAddress}"> <!-- Dropoff location as an address --> <parameter-mapping intentParameter="taxiReservation.dropoffLocation.name" urlParameter="dropoffAddress" /> </fulfillment> </action> </actions> |
Once created, reference your actions.xml
file from your AndroidManifest.xml
file using a <meta-data>
tag:
Credits
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Be the first to comment.