在使用GDK在谷歌眼镜上发布应用程序时,有什么方法可以嵌套语音触发器吗?例如,不只是说“好,玻璃”->“它的功率水平是多少?”我想让应用程序呈现一个选项。比如"ok,->“,它的功率等级是多少?”->“超过9000”还是“低于9000”。任何帮助都会很好!
发布于 2013-11-21 15:43:30
如果玻璃上安装了多个具有相同语音触发意图筛选器的活动/服务,则当您使用该语音触发器时,它们的所有名称(基于android:label属性的<activity>或AndroidManifest.xml中的<service>标记)将出现在消除歧义的“子菜单”中。
例如(假设res/xml/play_a_game_trigger.xml代表字符串“玩游戏”的语音触发器):
<activity android:label="Tennis">
<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/play_a_game_trigger" />
</activity>
<activity android:label="Bowling">
<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/play_a_game_trigger" />
</activity>会给你一个声音菜单流,看起来像
ok glass → play a game → Tennis
Bowling但是,请注意,该菜单还将包括来自使用相同语音触发器的其他APK的活动/服务。
您可以在GDK文档的Voice Input页面上找到更多详细信息。
发布于 2013-11-29 10:29:31
正确的方法是在触发器内使用输入标记。
<trigger keyword="@string/start_app" >
<input prompt="@string/promt_text" />
</trigger>这将提示输入,并等待更多的音频语音。
然后,在您的活动中,您可以通过以下方式捕获此文本:
ArrayList<String> text = getIntent().getExtras().getStringArrayList(RecognizerIntent.EXTRA_RESULTS);https://stackoverflow.com/questions/20113753
复制相似问题