I use CLI to build my Cordova app, and I have added the Media plugin.
'cordova build' automatically adds the android.permission.RECORD_AUDIO to my AndroidManifest.xml even though I don't use that permission.
So how do I remove it? Each time I build to release, the permission is added to the apk.
In your project, edit the file plugins/org.apache.cordova.media/plugin.xml You'll see the android specific configuration
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="Media" >
<param name="android-package" value="org.apache.cordova.media.AudioHandler"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
</config-file>
...
remove the line <uses-permission android:name="android.permission.RECORD_AUDIO" />
like this the permission will not be added each time you build.
As the permission has already been added to AndroidManifest.xml, you'll have to remove it manually and then it should not come back next time you build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With