Reputation: 1674
I am using @ionic-native/android-permissions. My code in app.component.ts:
this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.RECORD_AUDIO).then(
(result)=>{
if(!result.hasPermission)
{
this.androidPermissions.requestPermissions(
[this.androidPermissions.PERMISSION.RECORD_AUDIO,
this.androidPermissions.PERMISSION.GET_ACCOUNTS]
).then(()=>{
// this.rootPage = HomePage;
window.location.reload();
});
}
});
It is working when I do :
ionic cordova run android
or
ionic cordova build android
or
ionic cordova build android --release
But the app is not asking for permission if I add --prod. i.e. :
ionic cordova run android --prod
or
ionic cordova build android --prod --release
So the device mic is not working for the app.
Upvotes: 1
Views: 1724
Reputation: 2033
I had this issue, and i solved it by adding permissions to config.xml then, popup will show and ask client for permissions. add permissions to config.xml
<platform name="android">
....
<config-file parent="/manifest" target="AndroidManifest.xml" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-feature android:name="android.hardware.microphone" android:required="true" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
</config-file>
....
</platform>
Upvotes: 0