You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Assistant触发OPEN_APP_FEATURE异常:仅启动APP无参数

App Actions通过Google Assistant触发仅启动ACTION_MAIN无参数的解决方案

问题背景

开发的安卓应用支持通过Google Assistant打开特定功能,使用App Actions Test工具测试时一切正常:应用可正常跳转至指定功能,能接收到Intent.ACTION_VIEW及feature参数。但直接通过Google Assistant语音或文本指令触发时,仅以Intent.ACTION_MAIN启动应用,且无功能参数。

已完成的操作:

  • 安卓设备、Android Studio、Google Play控制台登录同一账号
  • 构建版本已上传至Google Play控制台内部测试渠道

问题排查与修复方案

1. 等待App Actions索引完成

Google Assistant需要对Play控制台中上传的应用配置进行索引,此过程通常需要2-4小时。若刚上传完内部测试版本就测试,可能因索引未完成导致指令无法匹配BII。

  • 确认内部测试渠道的构建已发布,且测试设备安装的是该渠道的版本(而非本地调试版)
  • 等待足够时间后重新测试

2. 修正shortcuts.xml配置

  • 将shortcut的android:enabled设为true:false状态会导致Assistant无法识别该shortcut绑定的能力
  • 确认clickCollect_synonyms字符串数组中的值与你使用的触发短语完全匹配,比如包含"Click Collect"等对应同义词

修正后的shortcuts.xml片段:

<shortcut
    android:shortcutId="shop"
    android:shortcutShortLabel="@string/clickCollect"
    android:enabled="true">
    <capability-binding android:key="actions.intent.OPEN_APP_FEATURE">
        <parameter-binding
            android:key="feature"
            android:value="@array/clickCollect_synonyms" />
    </capability-binding>
</shortcut>

3. 简化Manifest中的Intent Filter

SplashActivity中存在多个ACTION_VIEW的intent filter,其中最后一个无data约束的filter可能导致Intent匹配冲突,干扰App Actions的Intent传递。建议移除该filter:

<!-- 移除以下无data的intent filter -->
<!-- <intent-filter
    android:autoVerify="true"
    tools:targetApi="m">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter> -->

4. 确保触发短语准确

使用与shortcut绑定参数匹配的指令,例如:

Hey Google, open Click Collect in Adnoc

避免使用模糊短语,确保Assistant能准确匹配到对应的App Actions能力。

5. 验证应用安装来源

测试设备必须安装从Google Play内部测试渠道下载的应用,本地调试版本不会被Google Assistant索引,无法触发App Actions。

调试补充

在Intent处理代码中添加日志,便于确认接收到的Intent信息:

private fun Intent.handleIntent() {
    Log.d("AppActionsDebug", "Intent Action: $action")
    Log.d("AppActionsDebug", "Extras: ${extras?.toString() ?: "No extras"}")
    when (action) {
        Intent.ACTION_VIEW -> handleIntent(extras)
        else -> {}
    }
}

内容的提问来源于stack exchange,提问作者Muhammad Anas Ahmed

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.17 12:57:15