Back up and restore attributes
Important
You should not back up or restore Encap SCA data.
How does file exclusion work?
- We list all files that should be excluded in a file in the Encap library:
Example: File containing list of exclusions in Encap library
<application
android:fullBackupContent="@xml/encap_backup_rules">
</application> - The Encap library automatically adds excluded files into the
AndroidManifest.xmlfile. This means that no action is required by you ifallowBackupis turned on or off. - If you need to make any selective exclusions inside of your app, then you can do this by overriding the content inside of your app's
AndroidManifest.xmlfile.Example: Override content inside AndroidManifest.xml<application
android:allowBackup="true"
tools:replace="android:fullBackupContent" // need to include this line to replace a file from a library
android:fullBackupContent="@xml/new_backup_rules"
android:dataExtractionRules="@xml/new_backup_data_extraction_rules"> // for apps targeting and running on API >= 31
</application>
Apps running API 31 and above
For apps running and targeting API 31 and above:
- You need to include
android:dataExtractionRules. - The old configuration
android:fullBackupContentis still required for devices running Android 11 or lower. - You need to include the files below in the
new_backup_rules.xmlandnew_backup_data_extraction_rules.xmlfiles:
- xml/new_backup_rules
- xml/new_backup_data_extraction_rules
Example: Files to include in new_backup_rules.xml<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="sharedpref" path="f2db0df050ae53f3e67a05b13dc116fe.xml"/>
<exclude domain="sharedpref" path="53a3da6c0fb288c82032fde4d8e0e21b.xml"/>
<exclude domain="sharedpref" path="369746349b261b229e719ad45b591359.xml"/>
<exclude domain="sharedpref" path="f721837aabf93b441e567b9077cbe7bb.xml"/>
<exclude domain="sharedpref" path="08a8e5535536315b856ad4070e329d16.xml"/>
<exclude domain="sharedpref" path="0733b8072054b721bd425df82e3d0b30.xml"/>
<exclude domain="sharedpref" path="df5d94f39eb00a3c1e294ba901e3efd1.xml"/>
<exclude domain="sharedpref" path="588a80614ad545c8ca78f17e59a71af3.xml"/>
<exclude domain="sharedpref" path="a45cd71216739905f02f210db62d0211.xml"/>
<exclude domain="sharedpref" path="d0db92acc9088c674fa7b0e65fdddd2b.xml"/>
<exclude domain="sharedpref" path="38b2c0e240810e9741d64db27c9d92ee.xml"/>
<exclude domain="sharedpref" path="220826cb4b12aab0f9fd9cb41685dfe9.xml"/>
<exclude domain="sharedpref" path="3690cd2328d9438c79c394617755b30b.xml"/>
<exclude domain="sharedpref" path="ea156d914e56c1a57223980d968a5ee2.xml"/>
<exclude domain="sharedpref" path="866b1fc0b7e7f470c0298cb12b021261.xml"/>
<exclude domain="sharedpref" path="5e51285d9f6837b0076c3d0be1dd5f0b.xml"/>
<exclude domain="file" path="fc8e705742a141990235464c74bce252"/>
</full-backup-content>Example: Files to include in new_backup_data_extraction_rules.xml<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
<cloud-backup disableIfNoEncryptionCapabilities="true">
<exclude
domain="sharedpref"
path="f2db0df050ae53f3e67a05b13dc116fe.xml" />
<exclude
domain="sharedpref"
path="53a3da6c0fb288c82032fde4d8e0e21b.xml" />
<exclude
domain="sharedpref"
path="369746349b261b229e719ad45b591359.xml" />
<exclude
domain="sharedpref"
path="f721837aabf93b441e567b9077cbe7bb.xml" />
<exclude
domain="sharedpref"
path="08a8e5535536315b856ad4070e329d16.xml" />
<exclude
domain="sharedpref"
path="0733b8072054b721bd425df82e3d0b30.xml" />
<exclude
domain="sharedpref"
path="df5d94f39eb00a3c1e294ba901e3efd1.xml" />
<exclude
domain="sharedpref"
path="588a80614ad545c8ca78f17e59a71af3.xml" />
<exclude
domain="sharedpref"
path="a45cd71216739905f02f210db62d0211.xml" />
<exclude
domain="sharedpref"
path="d0db92acc9088c674fa7b0e65fdddd2b.xml" />
<exclude
domain="sharedpref"
path="38b2c0e240810e9741d64db27c9d92ee.xml" />
<exclude
domain="sharedpref"
path="220826cb4b12aab0f9fd9cb41685dfe9.xml" />
<exclude
domain="sharedpref"
path="3690cd2328d9438c79c394617755b30b.xml" />
<exclude
domain="sharedpref"
path="ea156d914e56c1a57223980d968a5ee2.xml" />
<exclude
domain="sharedpref"
path="866b1fc0b7e7f470c0298cb12b021261.xml" />
<exclude
domain="sharedpref"
path="5e51285d9f6837b0076c3d0be1dd5f0b.xml" />
<exclude
domain="sharedpref"
path="6a5895f19a33c8d3c38ea7d8bc4b6887.xml" />
<exclude
domain="sharedpref"
path="3e766c5d429251ee0789de97ab4c71c6.xml" />
<exclude
domain="sharedpref"
path="com.google.android.gms.appid.xml" />
<exclude
domain="file"
path="fc8e705742a141990235464c74bce252" />
</cloud-backup>
<device-transfer>
<exclude
domain="sharedpref"
path="f2db0df050ae53f3e67a05b13dc116fe.xml" />
<exclude
domain="sharedpref"
path="53a3da6c0fb288c82032fde4d8e0e21b.xml" />
<exclude
domain="sharedpref"
path="369746349b261b229e719ad45b591359.xml" />
<exclude
domain="sharedpref"
path="f721837aabf93b441e567b9077cbe7bb.xml" />
<exclude
domain="sharedpref"
path="08a8e5535536315b856ad4070e329d16.xml" />
<exclude
domain="sharedpref"
path="0733b8072054b721bd425df82e3d0b30.xml" />
<exclude
domain="sharedpref"
path="df5d94f39eb00a3c1e294ba901e3efd1.xml" />
<exclude
domain="sharedpref"
path="588a80614ad545c8ca78f17e59a71af3.xml" />
<exclude
domain="sharedpref"
path="a45cd71216739905f02f210db62d0211.xml" />
<exclude
domain="sharedpref"
path="d0db92acc9088c674fa7b0e65fdddd2b.xml" />
<exclude
domain="sharedpref"
path="38b2c0e240810e9741d64db27c9d92ee.xml" />
<exclude
domain="sharedpref"
path="220826cb4b12aab0f9fd9cb41685dfe9.xml" />
<exclude
domain="sharedpref"
path="3690cd2328d9438c79c394617755b30b.xml" />
<exclude
domain="sharedpref"
path="ea156d914e56c1a57223980d968a5ee2.xml" />
<exclude
domain="sharedpref"
path="866b1fc0b7e7f470c0298cb12b021261.xml" />
<exclude
domain="sharedpref"
path="5e51285d9f6837b0076c3d0be1dd5f0b.xml" />
<exclude
domain="sharedpref"
path="6a5895f19a33c8d3c38ea7d8bc4b6887.xml" />
<exclude
domain="sharedpref"
path="3e766c5d429251ee0789de97ab4c71c6.xml" />
<exclude
domain="sharedpref"
path="com.google.android.gms.appid.xml" />
<exclude
domain="file"
path="fc8e705742a141990235464c74bce252" />
</device-transfer>
</data-extraction-rules>
Apps using FCM
If your application uses Firebase Cloud Messaging (FCM), then you should also exclude the com.google.android.gms.appid.xml file that contains the FCM registration ID from backup.
Restoring on a new device
If Encap data is backed up to one device and then restored on another device, then the Encap API is not able to decrypt the data restored on the second device correctly.
Want to learn more?
To learn more about Android backup and restore, see the Android developer documentation.