JBS
JBS

Reputation: 269

Android SpeechRecognizer extra "calling_package" missing

I need to integrate Android voice recognition feature in an Adobe Air generated app. For that, I've built an ANE around the SpeechRecognizer class of Android framework.

It's working fine on my Transformer TF300 (4.1.1) but I cannot make it work on any other device. I've tried both with an Acer Iconiatab A200 (4.0.3) and a Galaxy S2 (2.3).

I always get the following error:

Required extra "calling_package" missing in voice search intent.

I've tried to add this extra manually using intent.putExtra method, without any success.

Do somebody has the solution?

Thank you

Upvotes: 2

Views: 2169

Answers (1)

gregm
gregm

Reputation: 12169

I always just add a dummy package like this. It works on all the phones I have tested.

See here

public void recognizeDirectly(Intent recognizerIntent)
{
    // SpeechRecognizer requires EXTRA_CALLING_PACKAGE, so add if it's not
    // here
    if (!recognizerIntent.hasExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE))
    {
        recognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
                "com.dummy");
    }
    SpeechRecognizer recognizer = getSpeechRecognizer();
    recognizer.startListening(recognizerIntent);
}

Upvotes: 3

Related Questions