How does the allowBackup tag work?

2

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

Does not the allowBackup tag as true imply saving only this information?

When does backup / restore run?

    
asked by anonymous 30.09.2016 / 17:02

1 answer

3

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

If the app runs on an Android device 6 or higher, nothing needs to be done by the developer, backup / restore runs automatically.

The backup occurs when the following circumstances occur:

  • Device is inactive.
  • The device is loading.
  • The device is connected to the WI-FI network
  • At least 24 hours have passed since the last backup

restore occurs when you reinstall the application.

All data except the following are stored by default:

  • Files in folders returned by methods getCacheDir() and getCodeCacheDir() .
  • Files in "external storage", except those in the folder returned by the getExternalFilesDir() method.
  • Files in the folder returned by the getNoBackupFilesDir()

In versions prior to Android 6 the backup / restore can be done manually via adb using the bmgr , or by BackupApi , extending the < in> BackupAgentHelper .

More information in the documentation:

30.09.2016 / 18:26