Skip to content

Backup rules

Alexander Boldyrev edited this page Jan 15, 2024 · 1 revision

From SDK version 12.0.0 onwards, to comply with security recommendations the following changes have been made to the backup policy:

Only shared preferences related to the SDK are being backed up to the cloud, along with the database. Device to device transfer is disabled to avoid registration's data processing issues. These rules can be overridden at the application level.

Android 11 and lower

At the application level of your AndroidManifest.xml file add:

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

Then create your_backup_rules resource file in the /res/xml folder as following:

<full-backup-content>
    <include domain=["file" | "database" | "sharedpref" | "external" |
    "root" | "device_file" | "device_database" |
    "device_sharedpref" | "device_root" ] path="string"
    requireFlags=["clientSideEncryption" | "deviceToDeviceTransfer"] />
    <exclude domain=["file" | "database" | "sharedpref" | "external" |
    "root" | "device_file" | "device_database" |
    "device_sharedpref" | "device_root" ] path="string" />
</full-backup-content>

Android 12 or higher

At the application level of your AndroidManifest.xml file add:

<application ...
    android:dataExtractionRules="@xml/data_backup_rules"
</application>

In the res/xml folder, create the resource file data_backup_rules.xml as following:

<data-extraction-rules>
    <cloud-backup [disableIfNoEncryptionCapabilities="true|false"]>
        ...
        <include domain=["file" | "database" | "sharedpref" | "external" |
        "root" | "device_file" | "device_database" |
        "device_sharedpref" | "device_root" ] path="string"/>
        ...
        <exclude domain=["file" | "database" | "sharedpref" | "external" |
        "root" | "device_file" | "device_database" |
        "device_sharedpref" | "device_root" ] path="string"/>
        ...
    </cloud-backup>
    <device-transfer>
        ...
        <include domain=["file" | "database" | "sharedpref" | "external" |
        "root" | "device_file" | "device_database" |
        "device_sharedpref" | "device_root" ] path="string"/>
        ...
        <exclude domain=["file" | "database" | "sharedpref" | "external" |
        "root" | "device_file" | "device_database" |
        "device_sharedpref" | "device_root" ] path="string"/>
        ...
    </device-transfer>
</data-extraction-rules>

If there are no rules for a particular backup mode, such as if the <device-transfer> section is missing, that mode is fully enabled for all content except for no-backup and cache directories, as described in the documentation.

For additional information on backup and restore, please follow official documentation, along with testing guidelines.

Clone this wiki locally