[英]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:
我会检查两件事:
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"
actions.xml
file in 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. 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.