如何使用Voice Command在Google Glass上启动应用

时间:2013-09-06 02:08:29

标签: android voice-recognition launcher google-glass

我已经在我的Google眼镜上安装了一个应用程序,但是一旦我关闭它,我就必须连接回我的电脑才能再次启动它。

如何将我的应用注册到语音命令列表?例如。 “Ok Glass,给我看看立方体”。因此,在主屏幕上,您从“OK Glass”开始,然后说出用户定义的字符串(例如“向我显示多维数据集”),并且将启动与此字符串关联的应用程序。之前我通过在应用程序清单中添加几行来看到了这一点,但无法再找到它。我知道这可能需要一个有根据的Glass设备,但没关系。

This discussion与此问题有关,但没有给出答案。

1 个答案:

答案 0 :(得分:3)

有几种黑客方式可以启动应用;我写了一个描述它们的页面here

至于语音触发,你需要做两件事。

首先,将以下内容添加到您的清单中,作为您要启动的<activity>元素的子项:

<intent-filter>
    <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data android:name="com.google.android.glass.voice_trigger" android:resource="@string/voice_menu_trigger" />

并在res/string.xml

中创建相应的字符串

其次,在root设备上启用原生应用语音构建选项(我在此处描述所有实验以及如何启用它们here):

> adb shell setprop persist.lab.native_app_voice true

注意:这仅适用于Glass处于userdebug模式的情况。 Follow these instructions to put it into userdebug mode.

相关问题