java.lang.SecurityException: Not allowed to bind to service Intent in one plus device

2.6k views Asked by At

I wrote a speech recognition app using android's built-in speech recognition classes.

Once in a while the following Exception shows up in my developer console when the startListening() function is called on the speech recognizer object obtained using createSpeechRecognizer(context) function. I am using Android one plus one device. I have initialize voice recognition like this

mSpeechRecognizer = peechRecognizer.createSpeechRecognizer(getActivity());
mSpeechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 4000);
// mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS, 4000);
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
                RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);        

mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_PREFERENCE,
                "en");
mSpeechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
                getActivity().getPackageName());
mSpeechRecognizer.setRecognitionListener(this);
mSpeechRecognizer.startListening(mSpeechRecognizerIntent);

And Nothing happen after startlistening method.

0

There are 0 answers