Integrate with Assistant#88
Conversation
There was a problem hiding this comment.
Pull request overview
Adds initial Google Assistant / App Actions integration by declaring an OPEN_APP_FEATURE capability and binding dynamic shortcuts to that capability, while also expanding the number of generated shortcuts to the device-supported maximum.
Changes:
- Add
res/xml/shortcuts.xmldeclaring anactions.intent.OPEN_APP_FEATUREcapability and fulfillment intent. - Update dynamic shortcut generation to use
ShortcutManagerCompat.getMaxShortcutCountPerActivity()and bind each shortcut to the capability/parameter. - Reference
@xml/shortcutsfrom the manifest; update.gitignorefor docs folders.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/src/main/res/xml/shortcuts.xml | Declares Assistant capability + fulfillment intent for opening a card feature. |
| app/src/main/java/de/pawcode/cardstore/data/utils/ShortcutUpdater.kt | Uses device max shortcut count and adds capability binding to generated shortcuts. |
| app/src/main/AndroidManifest.xml | Adds android.app.shortcuts meta-data pointing at @xml/shortcuts. |
| .gitignore | Ignores additional docs directories. |
| <meta-data | ||
| android:name="android.app.shortcuts" | ||
| android:resource="@xml/shortcuts" /> |
There was a problem hiding this comment.
android.app.shortcuts meta-data is declared inside the MainActivity element. The platform reads the android.app.shortcuts resource from the <application> meta-data, so placing it on an <activity> can prevent the shortcuts/capabilities from being discovered. Move this <meta-data> to the <application> element (and remove it from the activity).
| <capability android:name="actions.intent.OPEN_APP_FEATURE"> | ||
| <shortcut-fulfillment> | ||
| <parameter android:name="feature.name" /> | ||
| </shortcut-fulfillment> | ||
| <intent | ||
| android:action="de.pawcode.cardstore.ACTION_VIEW_CARD" | ||
| android:targetClass="de.pawcode.cardstore.CardOverlayActivity" /> | ||
| </capability> |
There was a problem hiding this comment.
The capability intent launches CardOverlayActivity without providing CardOverlayActivity.EXTRA_CARD_ID. As implemented, CardOverlayActivity immediately calls finish() when the extra is missing, so this fulfillment intent can never successfully display a card. Either target an activity/route that can handle the feature.name parameter, or update the launched activity to gracefully handle missing card_id (e.g., resolve by store name and show a selector).
| <capability android:name="actions.intent.OPEN_APP_FEATURE"> | |
| <shortcut-fulfillment> | |
| <parameter android:name="feature.name" /> | |
| </shortcut-fulfillment> | |
| <intent | |
| android:action="de.pawcode.cardstore.ACTION_VIEW_CARD" | |
| android:targetClass="de.pawcode.cardstore.CardOverlayActivity" /> | |
| </capability> |
|
🎉 This PR is included in version 1.6.0-staging.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.6.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Add
shortcuts.xmlwith capabilities to integrate the app with Assistant.Also bump max shortcuts from 3 to the max amount that the users device allows.
This is currently in internal testing and not yet available to the public