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

如何通过Google Assistant为报警应用创建自定义静态快捷方式意图

实现Google Assistant葡萄牙语静态语音指令控制设备布防/撤防

可以通过Google Assistant的App Actions结合自定义意图实现该需求,以下是具体操作步骤:

1. 创建并配置Actions项目

  • 登录Google Actions Console,新建项目并将语言设置为pt-BR(巴西葡萄牙语)
  • 将项目与你的Android应用关联(需确保应用处于Google Play测试渠道或已正式发布)

2. 定义自定义意图与训练短语

在Actions项目中创建两个核心自定义意图:

  • armarDispositivo(布防设备)
  • desarmarDispositivo(撤防设备)

为每个意图添加巴西葡萄牙语的训练短语,覆盖目标指令场景:

  • 布防相关:"Ok Google, armar o dispositivo XPTO no aplicativo de teste"、"Ok Google, colocar o XPTO em modo de vigilância no aplicativo de teste"
  • 撤防相关:"Ok Google, desarmar o dispositivo XPTO no aplicativo de teste"、"Ok Google, desativar o modo de vigilância do XPTO no aplicativo de teste"

同时为意图配置参数dispositivoNome,用于识别用户提及的具体设备名称(如XPTO)。

3. 关联应用内功能

通过Deep Links将意图与应用内的布防/撤防逻辑绑定:

  • 在应用的AndroidManifest.xml中,为处理设备控制的Activity添加对应的intent-filter:
<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:scheme="seuapp" android:host="dispositivo" android:pathPattern="/armar/.*" />
</intent-filter>
<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:scheme="seuapp" android:host="dispositivo" android:pathPattern="/desarmar/.*" />
</intent-filter>
  • 在对应Activity中提取设备名称参数,调用已实现的布防/撤防功能。

4. 测试静态语音指令

  • 在Google Assistant设置中,将你的测试应用添加到“已链接的应用”列表
  • 直接说出预设的葡萄牙语指令,Google Assistant会直接触发应用内的对应功能,无需手动打开应用

注意事项

  • 训练短语可根据巴西用户的日常表达习惯补充更多变体,提升识别准确率
  • 测试阶段需使用Google Play内部测试或封闭测试版本,确保Assistant能识别到应用的意图配置

内容的提问来源于stack exchange,提问作者Vinicius Marques

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.19 21:05:22