Skip to content

A sample app that demonstrates how to push dynamic shortcuts that can be displayed in Google Assistant.

License

Notifications You must be signed in to change notification settings

actions-on-google/app-actions-dynamic-shortcuts

Repository files navigation

*:warning: Warning: Go to App Actions Dyanamic Shortcut sample for maintained sample.

⚠️ Warning: This App Actions Dyanamic Shortcut sample has migrated to App-Action directory in Andriod Github. This version will no longer be maintained.

This sample Android app manages items on to-do lists. Users can add items to to-do lists, search for items by category, and view information about completed tasks.

Note: This sample application is a fork of the Android to-do sample.

By implementing App Actions, the app can additionally respond to user queries (voice or text) with the help of Google Assistant.

App Actions uses Android Shortcuts in order to launch an app in response to the query. This app demonstrates how to implement dynamic shortcuts in an app to allow the user to launch the app directly into an in-app item requested by the user.

App Actions Demo

Requirements

For security and verification reasons, the account you use to upload your shortcuts.xml file with the App Actions test tool must have ownership of the application ID.

Additionally, you must meet the setup and usage requirements for App Actions and for the App Actions test tool.

How to use this sample

Clone or download the project to your preferred location. Then, import and modify the project with the following steps:

  1. In Android Studio, select Open an existing Android Studio project from the initial screen, or go to File > Open.

  2. Change the applicationId in app/build.gradle to the applicationId of one of your draft or published apps in the Google Play Console.

    android {
        defaultConfig {
            // This ID uniquely identifies your app on the device and in Google Play
            applicationId "com.example.myapp"
        }
    }
  3. Change the two (2) android:targetPackage in app/src/main/res/xml/shortcuts.xml to the applicationId in your app/build.gradle.

    <capability android:name="actions.intent.GET_THING">
        <intent
            android:targetPackage="PUT_YOUR_APPLICATION_ID_HERE"
            >
        </intent>
    </capability>
    <capability android:name="actions.intent.GET_THING">
        <intent
            android:targetPackage="PUT_YOUR_APPLICATION_ID_HERE"
            >
        </intent>
    </capability>
  4. In Android Studio, find the root directory of the sample.

  5. Select the build.gradle file.

  6. Follow the instructions presented by the IDE.

Then, you can try the App Actions by following these steps:

  1. Build and run the sample on your physical test device (Run "app").
  2. Open the app and create a to-do item.
  3. Open the Shortcuts test tool (Tools > Google Assistant > Shortcuts Test Tool).
  4. Select the shortcut corresponding to the to-do item, and press "Test". You should see an app opened for that to-do item.
Shortcuts Test Tool

If you run into any issues, check out the troubleshooting guide in our developer documentation.

Contribution guidelines

If you want to contribute to this project, be sure to review the contribution guidelines.

We use GitHub issues for tracking requests and bugs, please get support by posting your technical questions to Stack Overflow.

Report general issues with App Actions features or make suggestions for additional built-in intents through our public issue tracker.

References

About

A sample app that demonstrates how to push dynamic shortcuts that can be displayed in Google Assistant.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages