Member-only story

What if async storage values were to persist when a user changed devices or installed an app again?
You won’t believe it, but it works with Android right out of the box!
First we need to enable a backup option in the android/app/src/main/AndroidManifest.xml
file:
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/backup_rules"
Then create android/app/src/main/res/xml/backup_rules.xml
file with the list of files that should be added to backup:
<?xml version="1.0" encoding="utf-8"?>
<data-extraction-rules>
<cloud-backup>
<!-- your rules -->
</cloud-backup>
<device-transfer>
<!-- your rules -->
</device-transfer>
</data-extraction-rules>
docs: Backup and restore
Testing
More rules are listed below, but first, let’s look at how to test them.
- You can use Simulator or Real device
- Need to enable Backups:
Setting
=>System
=>Backup
- Then using
adb
you can create/restore backup:
# Replace `com.mycompany.myapp` with your app package!!!
adb shell bmgr…