Skip to content

Instantly share code, notes, and snippets.

@tseglevskiy
Created November 12, 2015 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tseglevskiy/e71cd081c2d8ef07c0a3 to your computer and use it in GitHub Desktop.
Save tseglevskiy/e71cd081c2d8ef07c0a3 to your computer and use it in GitHub Desktop.
Auto Backup
<application
android:allowBackup="true"
android:fullBackupContent="@xml/mybackupscheme"
.......
android:backupAgent=".MyBackupAgent"
>
.......
</application>
public class MyBackupAgent extends BackupAgent {
@Override
public void onRestoreFinished() {
super.onRestoreFinished();
Log.d("jollydroid", "onRestoreFinished");
}
@Override
public void onBackup(ParcelFileDescriptor oldState, BackupDataOutput data,
ParcelFileDescriptor newState) throws IOException {}
@Override
public void onRestore(BackupDataInput data, int appVersionCode, ParcelFileDescriptor newState) throws IOException {}
}
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include
domain="sharedpref"
path="pref1.xml"/>
</full-backup-content>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment