本文介绍了使用GDK启动应用程序时嵌套多个语音触发器的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用GDK在Google Glass上启动应用程序时,是否可以嵌套语音触发器?例如,不只是说确定,玻璃"->它的功率水平是多少?"我想让该应用提供一个选项.例如,好,玻璃"->它的功率水平是多少?" ->高于9000"或低于9000".任何帮助都会很棒!

Is there a way to nest voice triggers when launching an app on Google Glass using the GDK? For example instead of just saying "ok, glass" -> "What's its power level?" I'd like to have the app present an option. For example "ok, glass" -> "What's its power level?" -> "Over 9000" OR "Under 9000". Any help would be great!

推荐答案

如果在Glass上安装了具有相同语音触发意图过滤器的多个活动/服务,则其所有名称(基于广告的android:label属性当您说出语音触发器时,AndroidManifest.xml中的<activity><service>标签)将显示在歧义子菜单"中.

If you have multiple activities/services installed on Glass that have the same voice trigger intent filter, all of their names (based on the android:label attribute of the <activity> or <service> tag in AndroidManifest.xml) will appear in a disambiguation "submenu" when you speak that voice trigger.

例如(假设res/xml/play_a_game_trigger.xml代表字符串玩游戏" 的语音触发器):

For example (assume that res/xml/play_a_game_trigger.xml represents a voice trigger for the string "play a game"):

<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>

将为您提供类似于以下的语音菜单流程

would give you a voice menu flow that looks like

ok glass → play a game → Tennis
                         Bowling

但是请注意,该菜单还将包括来自 other APK的使用相同语音触发器的活动/服务.

Do note, however, that this menu would also include activities/services from other APKs that use the same voice trigger as well.

您可以在GDK文档的语音输入页面中找到更多详细信息.

You can find more details at the Voice Input page of the GDK documentation.

这篇关于使用GDK启动应用程序时嵌套多个语音触发器的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 20:00