Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpeechRecognizer: no selected voice recognition service

This is how i start my RecogniseListener intent:

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);   
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);

intent.putExtra("android.speech.extra.DICTATION_MODE", true);               
intent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,this.getPackageName());
intent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS,1);
sr.startListening(intent);

However, i get a strange behavior. It works on some phones (Samsung galaxy S5, in this case), but i get the following error on Lenovo K50-T5:

E/SpeechRecognizer: no selected voice recognition service

This is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lips.deafcommunication.deaflips">

<uses-permission android:name="android.permission.RECORD_AUDIO" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppThemeNoBar">
    <activity android:name=".MainActivity"
        android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".ChatInProgressActivity" android:screenOrientation="portrait"
                android:windowSoftInputMode="adjustPan"
                android:configChanges="keyboardHidden|orientation|screenSize"
        ></activity>
</application>
</manifest>
like image 594
Martis Avatar asked Dec 05 '22 15:12

Martis


1 Answers

In my case this warning case by user device if he/she not selected speech recognizer service by default here is photo of settings witch casing this problem, you see in photo no service selected by default,

enter image description here

i fix this by explicitly adding GoogleRecognitionService to my SpeechRecognizer,At the end my code look like this one

 this.speechRecognizer = SpeechRecognizer.createSpeechRecognizer(getActivity(), ComponentName.unflattenFromString("com.google.android.googlequicksearchbox/com.google.android.voicesearch.serviceapi.GoogleRecognitionService"));

So your code look like you using default speech intent, make your own custom recognitionlistener here is link to How can I use speech recognition without the annoying dialog in android phones

Note: Make sure you have install Google app

like image 148
Hamza Avatar answered Dec 23 '22 00:12

Hamza