I'm trying to push dynamic shortcuts to Google Assistant, as outlined here: Google's documentation.
The code runs fine, and if I tap & hold my icon in the launcher, I get the shortcut, but if I go to shortcuts in the Assistant settings, my app is not even listed...
Here's the code that creates the shortcut:
Intent intent = new Intent(this, MainActivity.class);
intent.setAction(Intent.ACTION_VIEW);
intent.putExtra("Test", "Test");
ShortcutInfoCompat.Builder scBuilder = new ShortcutInfoCompat.Builder(this, "Locate")
.setShortLabel("Locate item")
.setLongLabel("Locate specific item")
.addCapabilityBinding("custom.actions.intent.LOCATE")
.setIntent(intent);
if (!ShortcutManagerCompat.pushDynamicShortcut(this, scBuilder.build()))
{
Log.d("INTENT", "Failed...");
}
pushDynamicShortcut does not return false.
Also here's my shortcut.xml:
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<capability
android:name="custom.actions.intent.LOCATE"
app:queryPatterns="@array/LocateQueries">
<intent android:action="android.intent.action.VIEW">
</intent>
</capability>
<shortcut
android:shortcutId="Locate"
android:shortcutShortLabel="@string/actionLocate">
<intent
android:targetClass="com.XXX.MainActivity"
android:targetPackage="com.XXX" />
<capability-binding android:key="custom.actions.intent.LOCATE">
</capability-binding>
</shortcut>
</shortcuts>
The app is currently published on the store, and I'm working on an update...