Reputation: 63
I'm writing an mobile app using flutter. This app uses the package "speech_to_text" for speech recognition. When I test on my Huawei handy (Nova 5 pro), I get the following error:
[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(recognizerNotAvailable, Speech recognition not available on this device, , null)
This error occurs when I call the initialize method. I added following lines in "AndroidManifest.xml" direct under root node "manifest":
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
Does this package support Huawei devices? Is it dependant on google-api? Any help and suggestions are very appreciated!
Xinyu
Upvotes: 2
Views: 3876
Reputation: 29
In android->app->build.gradle targetSdkVersion flutter.targetSdkVersion to targetSdkVersion 28 this thing works for me
Upvotes: 1
Reputation: 51
just add these lines below the permissions in your project android manifest
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
Upvotes: 5