android - 谷歌助手未在 Android 应用上采用新的 URI
问题描述
我正在使用 App Actions 和 BII(内置意图)集成谷歌助手。问题是当我尝试使用语音命令时,它没有打开预期的屏幕,而只是打开了应用程序..当我调试它时,传入的 URI 是不同的(旧的),但我现在有一个不同的。
动作.xml
<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
<!-- Each parameter can reference an entity set using a custom ID. -->
<parameter name="feature">
<entity-set-reference entitySetId="FeatureEntitySet" />
</parameter>
<fulfillment urlTemplate="myappname://speed test/open{?appFeature}">
<parameter-mapping
intentParameter="feature"
urlParameter="appFeature" />
</fulfillment>
</action>
<entity-set entitySetId="FeatureEntitySet">
<entity
name="speedtest"
identifier="SPEED TEST" />
<!--<entity
name="second feature"
identifier="FEATURETWO" />-->
</entity-set>
AndroidManifest
<activity
android:name=".activities.SupportActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!-- Accepts URIs that begin with "myappname://speed test” -->
<data
android:host="speed test"
android:scheme="myappname" />
</intent-filter>
</activity>
SupportActivity.java
private void handleIntent(Intent intent) {
String appLinkAction = intent.getAction();
Uri appLinkData = intent.getData();
if (Intent.ACTION_VIEW.equals(appLinkAction) && appLinkData != null) {
String appFeature = appLinkData.getQueryParameter("appFeature");
if (appFeature != null && appFeature.contains("SPEED TEST")) {
//startActivity or do something
}
}
}
Google 助理语音命令:“打开 [我的应用名称] 速度测试”然后它只是打开应用“打开 [我的应用名称] 支持”然后它打开意图过滤器定义的预期活动
Uri String - myappname://speed test/open?appFeature=support on give voice command "Open [myappname] [support]" 但是当我将语音命令设为 Open [myappname] [speed test] 时,它会启动应用程序。应用内操作测试工具可以工作,但不能与谷歌助手一起使用,既不是语音也不是文本。
解决方案
确保您使用的是 3.4.2+ 应用操作测试工具 (AATT)。显示旧 URL 表示预览尚未更新为最新的actions.xml
.
推荐阅读
- spring-boot - Pushy APNS http2 协议 - io.netty.util.concurrent.PromiseCombiner 错误中没有初始化方法
- python - Jupyter notebook 停止打印输出
- python - 按条件过滤行并使用 python pandas 从数据框中选择多列
- javascript - 使用 domtoimage.toPng 为 pdf 页面内的两个 div 导出 pdf
- haskell - Haskell ForkIO 将线程数限制为某个值
- c++ - ROS 奇怪的转化行为
- javascript - 使用javascript基于交互式ggplot为过滤器创建选择
- amazon-web-services - 确认登录请求中的“用户会话无效” - AWS Cognito
- javascript - 映射对象的对象并推送非重复
- python - 如何制作两个不相互交互的独立下拉列表?