语音命令在谷歌玻璃应用程序? [英] Voice command for apps in Google Glass?
问题描述
我已经发展到对谷歌的玻璃上运行Android应用程序。我运行使用亚行吧。是否有可能给配置语音命令,这样我可以触发它说好吧玻璃+我的命令??
I have an android app developed to run on the google glass. And I run it using the adb. is it possible to give configure a voice command so that I can trigger it by saying "Ok GLASS" + "My Command" ??
推荐答案
更新 - XE16更新下面的方法行不通后,新的解决方案是在这里<一个href="http://stackoverflow.com/questions/23097828/why-is-my-voice-command-missing-from-the-ok-glass-menu-in-xe16">Why从XE16确定玻璃菜单我的声音命令失踪?
Update - After XE16 update the following method does not work, the new solution is here Why is my voice command missing from the ok glass menu in XE16?
什么,你需要做的是,
-
在清单文件中添加这些标签下,你想你的语音命令上触发的服务。
Inside the manifest file add these tags under the service which you wanted to trigger on your voice command.
<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" />
而你必须创建内部资源称为XML的文件夹,并添加名为 voice_trigger_start.xml
XML文件。
And you have to create a folder called xml inside res and add a xml file named as voice_trigger_start.xml
.
这里面添加这些行
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/its_me_amalan" />
打开值文件夹中的 RES
文件夹,并修改的strings.xml
,所以它看起来像这样
Open the values folder inside the res
folder and edit strings.xml
, so it will look like this
<resources>
<string name="app_name">Amalan</string>
<string name="its_me_amalan">Hello Amalan</string>
<string name="stop">Stop</string>
</resources>
现在安装应用程序在玻璃上,并说的 OK玻璃,您好Amalan 的和应用程序打开。
Now install the app onto Glass and say "ok glass, Hello Amalan" and the app opens.
参考:的http://pathofa$c$cr.com/2013/11/20/google-glass-adding-your-own-voice-commands-to-your-apps/
这篇关于语音命令在谷歌玻璃应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!