简体   繁体   English

Google上的操作-无法测试Android上的应用操作意图

[英]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 我的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. 在清单中,我已声明MainActivity已exported并使用了Deeplink和用于操作的meta。

<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. 我在Android Studio和我的手机上使用相同的Google帐户正确登录。 My account can access the Google Play Developer console and the app is already published. 我的帐户可以访问Google Play开发者控制台,并且该应用程序已经发布。

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. 尽管我确实为android:host看到了一个皮棉错误-“主机匹配区分大小写,并且只能使用小写字符”,所以您应该将其切换为小写。 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. “未安装应用程序消息”表示助手无法找到可以满足从action.xml构建的Intent的应用程序。 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从命令行启动“活动”,以确保正确设置了intent-filters ,例如:
    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. 如果效果良好,请再次检查处理此Intent的应用程序的软件包名称(安装在测试设备上)是否与Android Studio中具有actions.xml文件的软件包名称匹配。 When Assistant calls your Intent it will also specify the package name to ensure another app won't intercept and handle the Intent instead. 当Assistant调用您的Intent时,它还将指定程序包名称,以确保另一个应用不会拦截并处理该Intent。 You can also test this via adb by adding the package name to the end: 您还可以通过将包名称添加到末尾来通过adb进行测试:
    adb shell am start -a android.intent.action.VIEW \
            -c android.intent.category.BROWSABLE \
            -d "myapp://logMeasure?measureName=test" \
            com.yourpackage.from.studio.project

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

相关问题 App Action 适用于 App Actions 测试工具,但不适用于 Google Assistant - App Action Works on App Actions Test Tool But not On Google Assistant 无法将多个操作传递给通知操作意图 - unable passing multiple actions to notification action intent 在 Android 上,我无法让 actions.intent.OPEN_APP_FEATURE 在应用程序操作测试工具之外工作 - On Android, I cannot get actions.intent.OPEN_APP_FEATURE to work outside the App Actions Test Tool 无法在Android中使用“自定义意图操作”打开第二个应用 - Unable to open 2nd app using Custom Intent Action in Android 如何在 Android 应用中测试 Google Actions? - How Can I test Google Actions in Android app? 应用操作未与应用操作测试工具一起运行 - App Action not running with App Actions Test Tool 如何测试 android.intent.action.SYNC - how to test android.intent.action.SYNC 无法启动服务意图{act = android.intent.action.VIEW…} - Unable to start service Intent { act=android.intent.action.VIEW… } Android UI测试无法解决以下活动:Intent - Android UI test unable to resolve activity for: Intent Android NFC:启动了应用程序,但无意采取任何行动 - Android NFC: App launched, but action is not in intent
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM