我正在尝试使用“应用内促销 SDK”向使用
createShortcutSuggestionIntent
的用户建议快捷方式。
我已在内部测试下将签名的应用程序包提交到 Google Play 控制台。
我已使用应用程序操作测试工具创建了预览。我可以成功使用应用程序操作测试工具通过 actions.intent.OPEN_APP_FEATURE 运行应用程序操作,并且它在所需的活动中成功打开我的应用程序。
val shortcutsClient = AssistantShortcutSuggestionsClient.builder()
.setContext(this@MainActivity)
.setVerifyIntents(true)
.build()
val appShortcutIntent = AppShortcutIntent.builder()
.setIntentName("actions.intent.OPEN_APP_FEATURE")
.setPackageName("com.mypackage")
.setIntentParamName("feature")
.setIntentParamValue("test")
.build()
if (shortcutsClient.lookupShortcut(appShortcutIntent).await().isShortcutPresent) {
return
}
val orderShortcut = AppShortcutSuggestion.builder()
.setAppShortcutIntent(appShortcutIntent)
.setCommand("my shortcut phrase")
.build()
val intent = shortcutsClient.createShortcutSuggestionIntent(orderShortcut).await()
application.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
快捷方式建议活动会打开一小会儿,但不会呈现任何文本。这是错误:
Failed to get shortcut page response
com.google.android.apps.gsa.shared.speech.a.n: errorCode: -83902, engine: 2
at com.google.android.apps.gsa.s3.x.b(PG:1)
at com.google.android.apps.gsa.staticplugins.cs.a.f.d(PG:2)
at com.google.android.apps.gsa.s3.r.f(PG:7)
at com.google.android.apps.gsa.s3.r.c(PG:32)
at com.google.android.apps.gsa.s3.q.run(PG:1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at com.google.android.apps.gsa.shared.util.c.a.e.run(PG:2)
at com.google.android.apps.gsa.shared.util.c.a.bh.run(PG:1)
at com.google.android.apps.gsa.shared.util.c.a.bh.run(PG:1)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
at java.lang.Thread.run(Thread.java:1012)
at com.google.android.apps.gsa.shared.util.c.a.l.run(PG:5)