简体   繁体   中英

Actions on Google - Unable to test intent for app action on Android

I'm trying to open my deeplink by responding to app action intent. My actions.xml

<?xml version="1.0" encoding="utf-8"?>
<actions>
    <action intentName="actions.intent.RECORD_HEALTH_OBSERVATION" >
        <fulfillment urlTemplate="myapp://logMeasure{?measureName}">
            <parameter-mapping
                intentParameter="healthObservation.measuredProperty.name"
                urlParameter="measureName" />
        </fulfillment>
    </action>
</actions>

In the manifest, I've declared the MainActivity as exported and with deeplink and the meta for actions.

<activity
    android:name="com.myapp.MainActivity"
    android:exported="true">
    <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <category android:name="android.intent.category.BROWSABLE"/>
        <data
            android:host="logMeasure"
            android:scheme="myapp"/>
    </intent-filter>
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>
</activity>

<meta-data
    android:name="com.google.android.actions"
    android:resource="@xml/actions"/>

I'm correctly logged in with the same google account on android studio and my phone. My account can access the Google Play Developer console and the app is already published.

Here is the app action test tool screenshot with the configuration. 应用动作测试工具

When I click run, the assistant open, load and then display the toast with "App isn't installed." 助手无法打开我的深层链接

What am I missing?

At a glance, everything looks properly configured. Although I do see a lint error for your android:host - "Host matching is case sensitive and should only use lower-case characters" so you should probably switch that to just lowercase. I'm not sure that's the issue though.

The "App isn't installed message" means that Assistant is unable to find an app that can satisfy the Intent built from actions.xml. Two things I would check:

  1. Try starting your Activity from command line via adb to ensure your intent-filters are set up correctly, for example:
    adb shell am start -a android.intent.action.VIEW \
            -c android.intent.category.BROWSABLE \
            -d "myapp://logMeasure?measureName=test"
  1. If that works fine, then double check that the package name of the app that handles this Intent (installed on your test device) matches the one with the actions.xml file in Android Studio. When Assistant calls your Intent it will also specify the package name to ensure another app won't intercept and handle the Intent instead. You can also test this via adb by adding the package name to the end:
    adb shell am start -a android.intent.action.VIEW \
            -c android.intent.category.BROWSABLE \
            -d "myapp://logMeasure?measureName=test" \
            com.yourpackage.from.studio.project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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