Ionic Cordova Speech Recognition working in android version 8 or lower. But whenever I am running running the app in android version 9 or higher google tap to speak is not showing.
Also sharing the speech recognition code for better understanding:
getPermission() {
this.speechRecognition.hasPermission().then((hasPermission: boolean) => {
if (!hasPermission) {
this.speechRecognition.requestPermission();
}
});
}
startListening() {
let options = {
showPopup: true,
language: "en-US",
};
this.speechRecognition.startListening(options).subscribe((matches) => {
this.matches = matches;
this.cd.detectChanges();
});
this.isRecording = true;
}
stopListening() {
this.speechRecognition.stopListening().then(() => {
this.isRecording = false;
});
}
CodePudding user response:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<queries>
<intent>
<action android:name="android.speech.RecognitionService" />
</intent>
</queries>
Adding the above code to AndroidManifest.xml has solved my problem. Ionic Cordova Speech Recognition is working with Android 11.
CodePudding user response:
Though in my case environment is not ionic, but cordova only. I checked android10 and 7,8 devices, they are working. The corresponding APIs of android SDK is downloaded, cordova-plugin-speechrecognition is installed, and cordova version is v11.0.
I know it does not work android11 device, so I have been finding solution. According several informations, androidManifest.xml seems to include "android.speech.RecognitionService". But I don't know how to do...