admin管理员组文章数量:1289393
I implemented Dynamic Shortcuts in my app following the guides from the documentation. When using the App Actions Test Tool, logging in a device with the same account as Android Studio, everything works and I am able to open the shortcut list in Google Assistant and add the shortcut to be called with a single word.
However, when the app goes to production, this does not work. I have extracted the APK from Play Store to make sure I was sending the right one and the AndroidManifest.xml and the shortcuts.xml are identical.
For context: when in contact with the App Actions Review Team from Google, they made it clear to me that the problem is not review related. Meaning it must be some code issue. Since it works when testing, I am left to wonder what is wrong. I'd appreciate any pointers.
Manifest configuration for the main activity:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
// This one here
<data android:scheme="my_scheme" android:host="call_for_help" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
MainActivity code to push the Dynamic Shortcut:
val shortcutIntent = Intent(Intent.ACTION_VIEW, Uri.parse("my_scheme:call_for_help"))
val shortcutInfo = ShortcutInfoCompat.Builder(context, "my.package.name.help_shortcut")
.setShortLabel("Ajuda") // Words in Portuguese
.setLongLabel("Pedir ajuda") // Words in Portuguese
.addCapabilityBinding("actions.intent.OPEN_APP_FEATURE")
.setIntent(shortcutIntent)
.setIcon(IconCompat.createWithResource(context, R.mipmap.my_icon))
.build()
ShortcutManagerCompat.pushDynamicShortcut(context, shortcutInfo)
And the shortcuts.xml:
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android=";>
<capability android:name="actions.intent.OPEN_APP_FEATURE">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="my.package.name"
android:targetClass="my.package.name.MainActivity">
<parameter
android:name="feature"
android:key="feature"/>
</intent>
</capability>
</shortcuts>
When using the App Actions Test Tool it works. I am able to see the Dynamic Shortcut inside the shortcuts list in Google Assistant, and then add the shortcut and call it using my voice.
本文标签: androidDynamic Shortcut for Google Assistant working in testing but not in productionStack Overflow
版权声明:本文标题:android - Dynamic Shortcut for Google Assistant working in testing but not in production - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741407411a2377030.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论