2013-07-22 4 views
0

나는 음성 인식을 사용하는 응용 프로그램을 생성하며, 그러나 그것은 실패 새로운 갤럭시 S 4와 갤럭시 노트 II에 대부분의 휴대폰에서 작동 :Galaxy S IV에 음성 인식기 의도가 없습니다?

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 

이이 트리거 코드 :

void speak() { 
     Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); 

     //intent.putExtra(RecognizerIntent.EXTRA_PROMPT, metTextHint.getText().toString()); 

     // Given an hint to the recognizer about what the user is going to say 
     //There are two form of language model available 
     //1.LANGUAGE_MODEL_WEB_SEARCH : For short phrases 
     //2.LANGUAGE_MODEL_FREE_FORM : If not sure about the words or phrases and its domain. 
     intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, 
       RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); 

     int noOfMatches = 3; 
     // Specify how many results you want to receive. The results will be 
     // sorted where the first result is the one with higher confidence. 
     intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, noOfMatches); 
     intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak now"); 
     intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 2000); 
     intent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 2000); 

     //Start the Voice recognizer activity for the result. 
     startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE); 
    } 

이 오류는 기기에 적절한 애플리케이션이 없기 때문에 발생하지만 새로운 기기에는 음성 인식 기능이 없다고 생각하기 어렵습니다. 안드로이드 4.2.2에 몇 가지 변화가 있습니까?

+0

당신은 설정에 사라와 음성 공급자가 설정되어 있는지 확인 했습니까? 그것은 언어와 입력 아래에 있어야합니다, 음성에 대한 섹션이 있습니다. 그것의 삼성 노트 2에, 그래서 그것은 S4에 있어야합니다. –

답변

0

Google 음성 검색을 설치/사용하도록 설정하십시오.

0

예외 처리.

사용자가 응용 프로그램을 추가하거나 삭제할 때 의도가 일치하고 상황이 변경 될 수 있다고 보장 할 수 없습니다. 아마도 안드로이드의 미래 버전에서는 일치가 사라질 수도 있고, 휴대 전화와 완전히 다른 하드웨어를 가진 안드로이드 포트 에서 일치가 사라질 수도 있습니다. 심지어 이라도 많은 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 

    } 
관련 문제