Google Glass 中应用程序的语音命令?

2024-02-27

我开发了一个在谷歌眼镜上运行的 Android 应用程序。我使用 adb 运行它。是否可以配置一个语音命令,以便我可以通过说“Ok GLASS”+“我的命令”来触发它?


更新 - XE16更新后以下方法不起作用,新的解决方案在这里为什么 XE16 的 ok glass 菜单中缺少我的语音命令? https://stackoverflow.com/questions/23097828/why-is-my-voice-command-missing-from-the-ok-glass-menu-in-xe16

你要做的是,

  1. 在清单文件内,在您想要通过语音命令触发的服务下添加这些标签。

    <intent-filter>
        <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
    </intent-filter>
    <meta-data
        android:name="com.google.android.glass.VoiceTrigger"
        android:resource="@xml/voice_trigger_start" />
    
  2. 你必须在 res 中创建一个名为 xml 的文件夹,并添加一个名为的 xml 文件voice_trigger_start.xml.

  3. 在里面添加这些行

    <?xml version="1.0" encoding="utf-8"?>
    <trigger keyword="@string/its_me_amalan" />
    
  4. 打开里面的values文件夹res文件夹并编辑strings.xml,所以它看起来像这样

    <resources>
        <string name="app_name">Amalan</string>
        <string name="its_me_amalan">Hello Amalan</string>
        <string name="stop">Stop</string>
    </resources>
    

现在将应用程序安装到 Glass 上并说“好的玻璃,你好阿玛兰”然后应用程序打开。

参考:http://pathofacoder.com/2013/11/20/google-glass-adding-your-own-voice-commands-to-your-apps/ http://pathofacoder.com/2013/11/20/google-glass-adding-your-own-voice-commands-to-your-apps/

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Google Glass 中应用程序的语音命令? 的相关文章

随机推荐