Google assistant not taking the new URI on Android app

喜你入骨 提交于 2020-12-15 06:09:59

问题


I'm Integrating the google assistant using App Actions and BII(Built-in Intents). The issue is when I tried with the voice command it's not opening the intended screen rather it just opens the app..when I debugged it incoming URI is different(Old one) but I have a different one now.

Actions.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 Assistant Voice Command: "Open [my app name] speed test" then it just opens the app "Open [myappname] support" then it opens the intended activity where the intent filter defined

Uri String - myappname://speed test/open?appFeature=support on giving voice command "Open [myappname] [support]" but when I give voice command as Open [myappname] [speed test] it launches the app. In-App Action Test Tool working but not with google assistant neither voice nor text.


回答1:


Make sure you're using 3.4.2+ App Actions Test Tool (AATT). Showing the old URL is a sign that the preview hasn't been updated with the latest actions.xml.



来源:https://stackoverflow.com/questions/64484644/google-assistant-not-taking-the-new-uri-on-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!