*:warning: Warning: Go to App Actions Dyanamic Shortcut sample for maintained sample.
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.
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.
Clone or download the project to your preferred location. Then, import and modify the project with the following steps:
-
In Android Studio, select Open an existing Android Studio project from the initial screen, or go to File > Open.
-
Change the
applicationId
in app/build.gradle to theapplicationId
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" } }
-
Change the two (2)
android:targetPackage
in app/src/main/res/xml/shortcuts.xml to theapplicationId
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>
-
In Android Studio, find the root directory of the sample.
-
Select the
build.gradle
file. -
Follow the instructions presented by the IDE.
Then, you can try the App Actions by following these steps:
- Build and run the sample on your physical test device (Run "app").
- Open the app and create a to-do item.
- Open the Shortcuts test tool (Tools > Google Assistant > Shortcuts Test Tool).
- Select the shortcut corresponding to the to-do item, and press "Test". You should see an app opened for that to-do item.
If you run into any issues, check out the troubleshooting guide in our developer documentation.
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.