Android Galaxy S IV没有语音识别器意图?

Android Galaxy S IV没有语音识别器意图?,android,android-4.2-jelly-bean,voice-recognition,Android,Android 4.2 Jelly Bean,Voice Recognition,我创建了一个使用语音识别的应用程序,它可以在大多数手机上运行,但是在新的galaxy S IV和galaxy note II上它失败了: java.lang.RuntimeException: Unable to start activity ComponentInfo{<my.pakage.myactivity>/<my.pakage.myactivity>}: android.content.ActivityNotFoundException: No Activity

我创建了一个使用语音识别的应用程序,它可以在大多数手机上运行,但是在新的galaxy S IV和galaxy note II上它失败了:

java.lang.RuntimeException: Unable to start activity ComponentInfo{<my.pakage.myactivity>/<my.pakage.myactivity>}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.speech.action.RECOGNIZE_SPEECH (has extras) }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2247)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2297)
at android.app.ActivityThread.access$700(ActivityThread.java:152)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5328)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.speech.action.RECOGNIZE_SPEECH (has extras) }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1659)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1434)
at android.app.Activity.startActivityForResult(Activity.java:3430)
at android.support.v4.app._HoloActivity.superStartActivity(_HoloActivity.java:717)
at android.support.v4.app._HoloActivity.startActivityForResult(_HoloActivity.java:698)
at android.support.v4.app._HoloActivity.startActivityForResult(_HoloActivity.java:689)
at com.ltandfumbles.soundoff.activites.Record.speak(Record.java:263)
at com.ltandfumbles.soundoff.activites.Record.onCreate(Record.java:96)
at android.app.Activity.performCreate(Activity.java:5250)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
... 11 more   

我意识到错误是由于设备上没有合适的应用程序造成的,但我发现很难相信新设备没有任何语音识别功能。android 4.2.2中是否有一些需要说明的更改?

请确保已安装/启用Google Voice Search。

处理异常

无法保证意图会匹配,并且 随着用户添加和删除应用程序,情况可能会发生变化。 可以想象,在未来版本的安卓系统中,或者在未来版本中,匹配可能会消失 Android的一个端口,硬件与手机非常不同。甚至 如果它能在许多Android配置中工作,这仍然是一个例外 你应该处理

您可以在调用之前检查该操作:

    // Check to see if a recognition activity is present
    PackageManager pm = context.getPackageManager();
    List<ResolveInfo> activities = pm.queryIntentActivities(
            new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),0);
    if (activities.size() == 0) {
          // At this point there is no recognition library and you
          // should handle it here

    }
//检查是否存在识别活动
PackageManager pm=context.getPackageManager();
列出活动=pm.querytentActivities(
新意图(识别者意图、行动、识别、言语),0);
如果(activities.size()==0){
//在这一点上,没有识别库和您
//你应该在这里处理
}

您是否已进入设置并确保设置了语音提供商?它应该在语言和输入下,有一个语音部分。它在三星Note 2上,所以应该在S4上。
    // Check to see if a recognition activity is present
    PackageManager pm = context.getPackageManager();
    List<ResolveInfo> activities = pm.queryIntentActivities(
            new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH),0);
    if (activities.size() == 0) {
          // At this point there is no recognition library and you
          // should handle it here

    }