繁体   English   中英

Google 助理未在 Android 应用程序上使用新的 URI

[英]Google assistant not taking the new URI on Android app

我正在使用 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>

安卓清单

<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>

支持活动.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
           
        }
    }
}

谷歌助手语音命令:“打开[我的应用程序名称]速度测试”然后它只是打开应用程序“打开[myappname]支持”然后它打开意图过滤器定义的预期活动

Uri 字符串 - myappname://speed test/open?appFeature=support 提供语音命令“Open [myappname] [support]”,但是当我将语音命令设为 Open [myappname] [speed test] 时,它会启动应用程序。 应用内操作测试工具可以正常工作,但不能与 google 助手一起使用,既不支持语音也不支持文本。

确保您使用的是 3.4.2+ 应用操作测试工具 (AATT)。 显示旧 URL 表示预览尚未使用最新的actions.xml进行更新。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM