Setting the initial state for opt-in/opt-out - Monaca¶
Edit config.xml
¶
The initial optIn/optOut state can be set in the config.xml
file. Depending on your Cordova version, the setup procedure differs.
Creating a config-file tag (Cordova version 7.1 and above)¶
iOS Platform¶
Please insert the following XML construct into the <platform name="ios">
tag. The inner <true />
tag would result in an initial opt-in setting, <false />
in an initial opt-out setting.
<config-file parent="RPREndUserOptInDefault" target="*-Info.plist">
<false />
</config-file>
Android Platform¶
Please insert the following XML construct into the <platform name="android">
tag. android:value="true"
tag would result in an initial opt-in setting, android:value="false"
in an initial opt-out setting.
<config-file parent="./application" target="AndroidManifest.xml">
<meta-data android:name="io.repro.android.EndUserOptInDefault" android:value="false">
</meta-data>
</config-file>
Creating a custom-config-file tag (Cordova below version 7.1)¶
Cordova earlier to version 7.1 does not use config-file tags, therefore the cordova-custom-config plugin is necessary.
If you do not have the cordova-custom-config plugin already installed please refer to the official Monaca documentation here on how to install cordova-custom-config.
iOS Platform¶
Please insert the following XML construct into the <platform name="ios">
tag. The inner <true />
tag would result in an initial opt-in setting, <false />
in an initial opt-out setting.
<custom-config-file parent="RPREndUserOptInDefault" target="*-Info.plist">
<false />
</custom-config-file>
Android Platform¶
Please insert the following XML construct into the <platform name="android">
tag. android:value="true"
tag would result in an initial opt-in setting, android:value="false"
in an initial opt-out setting.
<custom-config-file parent="./application" target="AndroidManifest.xml">
<meta-data android:name="io.repro.android.EndUserOptInDefault" android:value="false">
</meta-data>
</custom-config-file>