正如我所发现的,如果某些功能不可用,可以设置语音约束来禁用语音触发器。我认为这也适用于消除歧义子菜单,所以我尝试在子菜单中的一个活动上设置一个约束,而不是对其他的。然而,这不只是禁用该子菜项(“从列表中选择”),而是禁用了整个菜单(“发出请求”)。下面是我的清单和语音触发xml资源:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.twintitanium.glassapps.decisionmaker"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<service
android:name="com.twintitanium.glassapps.decisionmaker.DecisionMakerService"
android:enabled="true"
android:exported="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
</service>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.MenuActivity"
android:enabled="true"
android:theme="@style/MenuTheme" >
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.ChooseFromListActivity"
android:label="@string/choice_from_list"
android:icon="@drawable/ic_choose_from_list" >
<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/make_a_request_with_network_constraint_trigger" />
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.RollDieActivity"
android:label="@string/die_roll"
android:icon="@drawable/ic_roll_die" >
<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/make_a_request_trigger" />
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.FlipCoinActivity"
android:label="@string/coin_flip"
android:icon="@drawable/ic_flip_coin" >
<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/make_a_request_trigger" />
</activity>
<activity
android:name="com.twintitanium.glassapps.decisionmaker.YesNoActivity"
android:label="@string/yes_or_no"
android:icon="@drawable/ic_yes_no" >
<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/make_a_request_trigger" />
</activity>
</application>
</manifest>正如您所看到的,我将make_a_request_with_network_constraint_trigger用于ChooseFromListActivity,而make_a_request_trigger用于其他活动。
make_a_request_with_network_constraint_trigger.xml:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/glass_voice_trigger">
<constraints
network="true" />
</trigger>make_a_request_trigger.xml:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/glass_voice_trigger" />(为了澄清,“@string/glaseVoice触发器”是“发出请求”)。
给一个活动的网络约束是否会禁用整个菜单,即使其他活动没有相同的约束呢?是否有另一种方式有选择地约束一种活动而不是其他活动?
发布于 2014-01-03 22:25:54
这听起来不像是你想要的行为。请您在我们的问题跟踪器上输入一个bug,这样我们就可以进一步调查了吗?
https://stackoverflow.com/questions/20913804
复制相似问题