Disable or modify automated backups for your Android app

All Android versions starting from Android 6.0 (API level 23) back up your app’s data files and then automatically restore them when the app is reinstalled. To limit unexpected behavior from your application when invalidateExistingUser: true, if the backup is outdated, or if you are testing, you should either disable automated backups or exclude appropriate SDK files from full backup.

Instructions

We recommend disabling automated backups for your app. To do this, use the following in your AndroidManifest.xml file.

<application android:allowBackup="false" ...

If your application must allow backups, be sure to exclude appropriate SDK files from full backup. To do this, add an .xml file with backup rules to your app, and then specify that .xml file in the AndroidManifest.xml file:

<application android:fullBackupContent="@xml/my_backup_rules"...

The following files must be excluded by adding backup rules for them:

<exclude domain="sharedpref" path="IBM_MCE_SDK_DATA.xml"/>
<exclude domain="database" path="mce3x.sqlite"/>
<exclude domain="database" path="mce.attributes"/>

Additionally, you must exclude all Campaign SDK plugins that your app uses.

  • Here is a rule for locations:
<exclude domain="database" path="locations.sqlite"/>
<exclude domain="database" path="cognitive_location.sqlite"/>
  • Here is a rule for inbox messages:
<exclude domain="database" path="messages.sqlite"/>

Here is a rule for in-app messages:

<exclude domain="database" path="mceInappMessages.sqlite"/>

For more information about including and excluding files from backup, see Back up user data with Auto Backup in the Android Developer Help Center.