I'm having problems using the RecognizerIntent API on Android 2.2.
When I call the API using this code:

  Intent intent = new
Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
  intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
  startActivityForResult(intent, REQUEST_CODE_VOICE_SEARCH);

which looks like it should work, the search popup says "Unknown
problem" on the device and in the logs it states:

01-17 14:25:30.433: ERROR/RecognitionActivity(9118):
ACTION_RECOGNIZE_SPEECH intent called incorrectly. Maybe you called
startActivity, but you should have called startActivityForResult (or
otherwise included a pending intent).
01-17 14:25:30.433: INFO/RecognitionControllerImpl(9118):
startRecognition(#Intent;action=android.speech.action.RECOGNIZE_SPEECH;launchFlags=0x800000;component=com.google.android.voicesearch/.IntentApiActivity;B.fullRecognitionResultsRequest=true;S.android.speech.extra.LANGUAGE_MODEL=free_form;end)
01-17 14:25:30.433: INFO/RecognitionControllerImpl(9118): State
change: STARTING -> STARTING
01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118): required
extra 'calling_package' missing in voice search intent
01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118):
ERROR_CLIENT
01-17 14:25:30.443: ERROR/RecognitionControllerImpl(9118):
ERROR_CLIENT

It looks like the problem is the missing "calling_package" extra; on
the RecognizerIntent page it states that this extra is:

The extra key used in an intent to the speech recognizer for voice
search. Not generally to be used by developers. The system search
dialog uses this, for example, to set a calling package for
identification by a voice search API. If this extra is set by anyone
but the system process, it should be overridden by the voice search
implementation.

As far as I can tell, I don't need to override this extra, so why am I
getting this error? How can I fix my code?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to