I am now developing a Cordova Plugin
, I wanna add
android:allowBackup="true"
into AndroidManifest.xml
, but I do not know how to specify it in plugin.xml
.
The configuration edit that has worked for me was:
<platform name="android">
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
<application android:allowBackup="false"/>
</edit-config>
</platform>
EDIT Feb-2020: Please refer to answer from @Shashank Agrawal below for cordova-android >= 7
Answer shared by @Muhammad Omar works for cordova-android < 7. But things changed for cordova-android >= 7
https://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html
So you need to change it a bit for
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:allowBackup="false"/>
</edit-config>
</platform>
The configuration edit that has worked for me was:
<platform name="android">
<edit-config file="AndroidManifest.xml" target="/manifest/application" mode="merge">
<application android:allowBackup="false"/>
</edit-config>
</platform>
To avoid android app from restoring backup on install, following config added to config.xml.
Ensure xml namespace is defined. Cordova build failed without this for me.
Solved by adding below.
<platform name="android">
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="false" />
</edit-config>
</platform>
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