> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Exclude MoEngage Storage File from Auto-Backup

> Exclude MoEngage storage files from Android auto-backup to prevent data corruption after restore.

<Warning>
  Mandatory integration step to prevent data corruption.
</Warning>

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

For more information, refer to [Auto Backup](https://developer.android.com/guide/topics/data/autobackup).

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.

<CodeGroup>
  ```xml AndroidManifest.xml wrap theme={null}
  <application
  ...
  android:fullBackupContent="@xml/backup_descriptor">
  </application>
  ```
</CodeGroup>

# 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.

<CodeGroup>
  ```xml XML wrap theme={null}
  <?xml version="1.0" encoding="utf-8"?>
  <full-backup-content>
  <exclude domain="database" path="MOEInteractions"/>
  <exclude domain="sharedpref" path="pref_moe.xml"/>
  <exclude domain="sharedpref" path="pref_moe_common.xml"/>
  </full-backup-content>
  ```
</CodeGroup>

If you only want to exclude files only from MoEngage SDK instead of creating a new file you can directly add the backup descriptor file provided by the SDK to the manifest file as shown below.

<CodeGroup>
  ```xml AndroidManifest.xml wrap theme={null}
  <application
  ...
  android:fullBackupContent="@xml/com_moengage_backup_descriptor">
  </application>
  ```
</CodeGroup>

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.

<CodeGroup>
  ```xml XML wrap theme={null}
  <application
      ...
      android:fullBackupContent="@xml/old_config.xml"
      android:dataExtractionRules="@xml/new_config.xml"
      ...>
  </application>
  ```
</CodeGroup>

# Exclude MoEngage Files in the configuration file.

You can exclude MoEngage files from the configuration as shown below

<CodeGroup>
  ```xml XML wrap theme={null}
  <data-extraction-rules>
    <cloud-backup>
      ...
      <exclude domain="database" path="MOEInteractions"/>
      <exclude domain="sharedpref" path="pref_moe.xml"/>
      <exclude domain="sharedpref" path="pref_moe_common.xml"/>
    </cloud-backup>
    <device-transfer>
      ...
      <exclude domain="database" path="MOEInteractions"/>
      <exclude domain="sharedpref" path="pref_moe.xml"/>
      <exclude domain="sharedpref" path="pref_moe_common.xml"/>
      ...
    </device-transfer>
  </data-extraction-rules>
  ```
</CodeGroup>

If you only want to exclude files only from MoEngage SDK, instead of creating a new file, you can directly add the backup descriptor file and data extraction rules file provided by the SDK to the manifest file, as shown below.

<CodeGroup>
  ```xml AndroidManifest.xml wrap theme={null}
  <application
  ...
  android:fullBackupContent="@xml/com_moengage_backup_descriptor"
  android:dataExtractionRules="@xml/com_moengage_data_extraction_rules"
  >
  </application>
  ```
</CodeGroup>
