Build App Actions

App Actions allow your app users to trigger existing functionality in your Android app with queries to Google Assistant. There are five major steps to extending your Android app with App Actions:

  1. Identify the in-app functionality to trigger.
  2. Find a built-in intent (BII) that matches the in-app functionality.
  3. Provide fulfillment details for the built-in intent.
  4. Preview your App Actions on a test device.
  5. Request App Actions review and deployment.

To try creating an App Action using a sample app, follow the Extend an Android app to Google Assistant with App Actions codelab.

Requirements

Before you start developing App Actions, meet the following requirements:

  • Have a Google account with access to the Google Play Console.
  • Have a physical Android device on which to test your App Actions. The recommended OS version is Android 8 (API level 26) or higher, although Actions run on devices back to Android 5 (API level 21).
  • Install the latest version of Android Studio.
  • Use the same Google account to sign in to Android Studio, the Google app on your test device, and the Google Play Console.
  • Set up and test that Assistant is working on your test device by long-pressing the Home button.

Identify app functionality

Start by choosing which Activities in your Android app make sense to be accessed via App Actions. These activities must be set up with Android deep link URLs and have corresponding intent filters in the Android app manifest. App Actions use deep link URLs generated by Assistant to take users directly to specific content in your app.

To test that your activities are accessible and that they can be triggered using App Actions, run the following adb command:

adb shell am start -a android.intent.action.VIEW -d "AppLinksURL"

For example:

adb shell am start -a android.intent.action.VIEW -d "https://www.example.com/deeplink"

If your activity doesn't launch correctly with the adb command, then check the following:

  • In your app manifest file, the activity has android:exported=true so it can be launched using intents from Google Assistant.
  • If using App Links URLs, follow all the steps in Handling Android App Links.

Find built-in intents that match app functionality

Review the built-in intent reference to find appropriate BIIs for your use case. Built-in intents model user queries for tasks they want to perform in your app, so look for BIIs that match key functionality and user flows in your app. For example, a food ordering app is more likely than a finance management app to use the actions.intent.ORDER_MENU_ITEM built-in intent.

Provide fulfillment details for built-in intents

Most of building an App Action is creating the actions.xml file for your app, where you specify your selected built-in intents and their corresponding fulfillment. Where a BII models the user query for a task, a fulfillment provides Assistant with information on how to perform the task.

In your actions.xml file, built-in intents are represented as <action> elements and each fulfillment is represented as a <fulfillment> element:

<actions>
    <action intentName="actions.intent.ORDER_MENU_ITEM">
        <fulfillment urlTemplate="exampleapp://browse{?food}">
            <parameter-mapping intentParameter="menuItem.name" urlParameter="food" />
        </fulfillment>
    </action>

    <action intentName="actions.intent.GET_THING">
        <fulfillment urlTemplate="exampleapp://search{?query}">
            <parameter-mapping intentParameter="thing.name" urlParameter="query"/>
        </fulfillment>
    </action>
</actions>

For most built-in intents, you extract intent parameters from the user query based on schema.org entities. Your app then uses those intent parameters to direct users to the desired functionality. For example, the above code maps the "thing.name" intent parameter to the "query" URL parameter in the deep link URL template.

For important details about creating an actions.xml file, reference Create Actions.xml. The schema page also describes how to specify parameter values your app expects (known as inventory) and how to update your AndroidManifest.xml file to reference the actions.xml resource.

Preview your App Actions

You can use a draft version of the app for testing. For more information, see Prepare and release rollout. We highly encourage you to test your app in draft mode before submitting it for review.

During development and testing, you use the App Actions test tool to test that App Actions work for your app. The App Actions test tool is an Android Studio plugin that creates a preview of your App Actions in Assistant (for your Google account). Using the test tool, you can test your fulfillments on a test device by providing BIIs with input parameters you expect to receive from users.

While previewing your App Actions, you can also trigger queries by voice on the device itself. This functionality is only available for queries listed in the built-in intents reference for App Actions. We recommend that you use voice triggering only for demonstration purposes rather than for regular testing.

Request App Actions review and deployment

Your App Actions won't be available to your users until they've been reviewed and approved. The App Actions review does not affect your Android app review and deployment status in Google Play. Even if your app submission is approved, your actions.xml may still be under review by Google.

When you subsequently deploy your app, App Actions stay activated. However, redeployed versions are subject to review by Google. If the new version is not working properly or contains policy violations, Google reserves the right to deactivate App Actions for your app.

To submit your App Actions for review, do the following:

  1. Meet the App Actions deployment requirements. These requirements help to optimize your app for Assistant and ensure that users enjoy a seamless experience when using App Actions.
  2. Accept the Actions on Google Terms of service in the Google Play Console (Pricing & distribution > Consent):

    Actions on Google Terms of Service in the Google Play console.

  3. Upload your app (containing actions.xml) to the Google Play console as normal for publishing.

  4. After you upload your app to the Play Console, we'll contact you at the email in Play Console with more information regarding the status of your App Actions review.