Android Manifest manipulation
Manipulating the Android Manifest from Cordova
Some Batch configuration requires editing AndroidManifest.xml
.
To do so, open up your config.xml
and scroll down to <platform name="android">
.
There, add a config-file
tag targeting the manifest's application tag:
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<!-- Your manifest edits go here. These lines will be added in AndroidManifest.xml's <application> tag. -->
</config-file>
</platform>
For example, adding opt-out metadata would look like:
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="batch_opted_out_by_default" android:value="true" />
</config-file>
</platform>
If your're encountering build issues, you might need to add xmlns:android="http://schemas.android.com/apk/res/android"
in the widget
tag attributes of your config.xml
:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova"
xmlns:android="http://schemas.android.com/apk/res/android" ...>
Note: These steps are not applicable for Ionic Capacitor.