我曾经创建过一个语音触发器,提示用户在开始我的活动或服务之前说出其他命令,例如:
ok glass
+-David
++-find me a parking lot
++-show me stock chart
在XE17或早期版本(XE16.2)中,使用语音命令或点击" ok glass"菜单将显示一个列表(带语音的垂直列表)或命令卡列表(水平菜单),但在XE17.1更新中,当我点击“确定玻璃”时,它只是挂起而没有菜单卡显示,只有确定的玻璃发射器,没有其他默认语音触发卡,经过短暂的调试,我发现它是相同的语音触发器
"android:resource="@xml/voice_trigger"
在AndroidMenifest.xml中声明导致问题,但语音命令仍然有效,有人可以帮忙吗?谢谢!
PS。而且,我尝试输入提示两个更快的赢得工作。
<input prompt="@string/glass_voice_prompt"/>
我的代码(GDK API19,rev.5)
&LT;&GT;的AndroidManifest.xml
<uses-permission android:name="com.google.android.glass.permission.DEVELOPMENT"/>
<activity
android:name=".PromptActivity"
android:label="@string/app_name"
android:theme="@style/MenuTheme"
android:icon="@drawable/ic"
android:enabled="true" />
<activity-alias
android:name="find me a parking lot"
android:label="find me a parking lot"
android:targetActivity=".PromptActivity"
android:icon="@drawable/hippo_icon" >
<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/hippo_voice_trigger_david" /> <!---HERE IS THE PROBLEM(two same voice trigger won't allow any more->
</activity-alias>
<activity-alias
android:name="show me stock chart"
android:label="show me stock chart"
android:targetActivity=".PromptActivity"
android:icon="@drawable/hippo_icon" >
<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/hippo_voice_trigger_david" /> <!---HERE IS THE PROBLEM->
</activity-alias>
&LT;&GT; hippo_voice_trigger_david.xml
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/glass_voice_david_prompt">
<constraints network="true" camera="true" />
</trigger>
&LT;&GT; RES /值/ strings.xml中
<string name="glass_voice_david_prompt">David</string>
&LT;&GT;这是LogCat例外:
FATAL EXCEPTION: main
Process: com.google.glass.home, PID: 5738
java.lang.NullPointerException
at com.google.glass.home.voice.TouchMainMenuActivity.onCreateOptionsMenu(TouchMainMenuActivity.java:122)
at android.app.Activity.onCreatePanelMenu(Activity.java:2543)
at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:439)
at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:602)
at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:555)
at android.app.Activity.openOptionsMenu(Activity.java:2878)
at com.google.glass.app.GlassVoiceActivity.openOptionsMenu(GlassVoiceActivity.java:456)
at com.google.glass.home.voice.TouchMainMenuActivity.onAttachedToWindow(TouchMainMenuActivity.java:93)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onAttachedToWindow(PhoneWindow.java:2793)
at android.view.View.dispatchAttachedToWindow(View.java:12592)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2458)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1242)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1025)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5699)