react-native-voice / voice

:microphone: React Native Voice Recognition library for iOS and Android (Online and Offline Support)
MIT License
1.83k stars 494 forks source link

[Android] Service not registered: android.speech.SpeechRecognizer #433

Open oussamatn opened 1 year ago

oussamatn commented 1 year ago

Hello,

I'm using your library to build an app for COSU device build on top of custom Android ROM. There's no Google apps ( Google LLC app, Play Store ...)

Each time I try to call your lib I got having this error each time: [Error: Service not registered: android.speech.SpeechRecognizer$Connection@d394e72]

Is there any solution to use the SpeechRecognizer without the Google apps ? Device Android version : 8.1

DLkhazan commented 1 year ago

found anything yet?

michele-ruocco commented 1 year ago

Even after ensuring that all necessary permissions are correctly configured on an Android device, it's crucial to verify the availability of the Google Speech Recognition Engine, such as com.google.android.googlequicksearchbox. This can be done by calling Voice.getSpeechRecognitionServices(). Given the diverse configurations of Android phones, even if the device has the googlequicksearchbox engine, it might be set to use alternative services.

To determine the Voice Assistive App and its associated service, follow these general steps on most Android phones:

Please note that the specific steps may vary depending on the Android model and manufacturer. For Huawei phones, it's essential to consider that some devices may not support the installation of Google Services. Ensure that the chosen Voice Assistive App aligns with the intended Google Speech Recognition Engine, taking into account potential variations in device configurations.

Also, Android 11 require this in manifest.xml file.

 <queries>
        <intent>
            <action android:name="android.speech.RecognitionService" />
        </intent>
    </queries>