How does the allowBackup tag work?

Asked

Viewed 479 times

3

Write to user device with getSharedPreferences("config" ,Context.MODE_PRIVATE) login name and some application settings.

Tag allowBackup as true implies saving only this information?

When the backup/Restore runs?

1 answer

4


The allowBackup determines whether or not the application data can be saved/restored by the backup and restore infrastructure.

If the application runs on an Android device 6 or higher, nothing needs to be done on the part of the programmer, the backup/Restore runs automatically.

Backup occurs when the following circumstances occur:

  • The device is inactive.
  • The device is charging.
  • The device is connected to the WI-FI network
  • It’s been at least 24 hours since the last backup

The Restore occurs when reinstalling the application.

By default all data except the following are saved:

  • Files in folders returned by methods getCacheDir() and getCodeCacheDir().
  • Existing files on "Sxternal", except those in the folder returned by method getExternalFilesDir().
  • Files in folder returned by method getNoBackupFilesDir()

In versions prior to Android 6 backup/Restore can be done manually, via adb, using the tool bmgr, or by using Backupapi, extending the class Backupagenthelper.

More information in the documentation:

Browser other questions tagged

You are not signed in. Login or sign up in order to post.