Exclude MoEngage Storage File from Auto-Backup
 

REQUIRED

Mandatory integration step to prevent data corruption.

Auto backup service of Andriod periodically backs up the Shared Preference file, Database files, and so on.

For more information, refer to Auto Backup.


The backup results in MoEngage SDK identifiers to be backed up and restored after re-install.
The restoration of the identifier results in your data being corrupted and the user not being reachable using push notifications.

To ensure data is not corrupted after a backup is restored, opt-out of MoEngage SDK storage files.

Add a backup descriptor in the application tag of the Manifest file.

The backup descriptor should be assigned to fullBackupContent attribute of the application tag.

AndroidManifest.xml
<application
...
android:fullBackupContent="@xml/backup_descriptor">
</application>

Exclude MoEngage Files in the descriptor file.

Exclude the following database file and shared preference file in the descriptor to ensure these files are not backed up.

XML
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="database" path="MOEInteractions"/>


<exclude domain="sharedpref" path="pref_moe.xml"/>
</full-backup-content>

 

For applications with targetSdkVersion 31 or above exclusion has to be done in the new format as well.

Exclusion for API level 31 or above

Add manifest flag

Declare the new configuration file in the manifest file as shown below.

XML

<application
    ...
    <!-- The below attribute is ignored. -->
    android:fullBackupContent="old_config.xml"
    <!-- You can point to your new configuration using the new
         dataExtractionRules attribute . -->
    android:dataExtractionRules="new_config.xml"
    ...>
</application>

 

Exclude MoEngage Files in the configuration file.

You can exclude MoEngage files from the configuration as shown below

XML

  <data-extraction-rules>
  <cloud-backup>
    ...
    <exclude domain="database" path="MOEInteractions"/>
    <exclude domain="sharedpref" path="pref_moe.xml"/>
  </cloud-backup>
  <device-transfer>
    ...
    <exclude domain="database" path="MOEInteractions"/>
    <exclude domain="sharedpref" path="pref_moe.xml"/>
    ...
  </device-transfer>
</data-extraction-rules>

 

Was this article helpful?
0 out of 0 found this helpful