Reputation: 88
I've implemented dynamic app shortcuts in my Android app, and they are working perfectly fine on my development device. I used App Actions Testing Tool (AATT) to validate the functionality, and everything checks out.
However, after releasing the app to production, other users are unable to see these dynamic shortcuts in the Google Assistant shortcuts list. The shortcuts are only visible on my development device, which has the same Google account I used during development. I want this dynamic feature for all my users to visible.
intent.setAction(Intent.ACTION_VIEW);
intent.putExtra(GET_THING_KEY, "blue"); // Add extras for the intent
// Build the shortcut
ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(context, "dynamic_change_color")
.setShortLabel("Change Color to Blue")
.setLongLabel("Change the light color to blue")
.setIcon(IconCompat.createWithResource(context, R.drawable.aav_profile_icon))
.addCapabilityBinding(
"actions.intent.GET_THING", "thing.name", listOf("blue"))
.setIntent(intent) // Associate the shortcut with the intent
.setLongLived(false)
.build();
// Push the shortcut
ShortcutManagerCompat.pushDynamicShortcut(context, shortcut);
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:shortcutId="change_color"
android:enabled="true"
android:shortcutShortLabel="@string/shortcut_label"
android:shortcutLongLabel="@string/shortcut_label"
android:shortcutDisabledMessage="@string/not_available"
android:icon="@drawable/aav_profile_icon">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="x.xx.x"
android:targetPackage="x.xx.x">
<extra android:name="color" android:value="red" />
</intent>
</shortcut>
</shortcuts>
Upvotes: 0
Views: 47