admin管理员组

文章数量:1230177

I'm currently trying to integrate deeplinks as google assistant shortcuts in my app.

So users add a phrase command, and these shortcuts are then indexed by Google Assistant, and assistant then lists the shortcuts. The only problem is, I can't see the shortcuts anywhere listed.

I tried dynamic shortcuts, using ShortcutInfoCompat, and AssistantShortcutSuggestionClient (Similar to Siri, where users add a phrase command and the shortcut is added to the device, then when user say the phrase it triggers the deeplink)

Below is an example of a dynamic shortcut. When this is pushed, google assistant is supposed to automatically index it. I also have AppActions registered on Google Play console, and my app is on Google play. But nothing. It doesn't work.

val shortcut = ShortcutInfoCompat.Builder(context, "dashboard_shortcut")
    .setShortLabel("Open Dashboard")
    .setLongLabel("Open the dashboard in My App")
    .setIcon(IconCompat.createWithResource(context, R.drawable.ic_dashboard))
    .setIntent(
        Intent(Intent.ACTION_VIEW).apply {
            data = Uri.parse("myapp://dashboard")
        }
    )
    .build()

ShortcutManagerCompat.pushDynamicShortcut(context, shortcut)

Has anyone had any luck with this? Google's documentation is basically non existent, and their plugin for shortcuts hasn't been maintained in years.

So is Google Assistant Shortcuts officially dead for Android? How does Whats app or facebook do this? They must have access to private apis or they registered their app with Google somehow.

I'd appreciate anybody's input here.

本文标签: