Android versions of 6.0 and above (API 23) will back up your app’s data files and then automatically restore them when the app is reinstalled. This can cause unexpected behavior if you are using invalidateExistingUser: true, if the backup is outdated, or if you are testing.

We recommend you disable automated backups for your app by using:

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

in your AndroidManifest.xml file.

If your application must allow backups for other purposes, be sure to exclude the appropriate SDK files from full backup. You do this by adding an .xml file with backup rules to your app, and then specifying 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"/>

If you use locations, you must also exclude:

<exclude domain="database" path="locations.sqlite"/>
<exclude domain="database" path="cognitive_location.sqlite"/>

If you use inbox messages, you must also exclude:

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

Finally, if you use in-app messages, you must also exclude:

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

This will ensure that an outdated backup does not cause problems when your app is reinstalled.

More information about including and excluding files from backup is documented at Including and excluding files from backup.

Join The Discussion

Your email address will not be published. Required fields are marked *