Android Auto Backup for Apps (100 Days of Google Dev)

By: Google Developers

251   11   29963

Uploaded on 07/06/2015

Android Backup is the automatic, cloud-based backup and restore of users’ apps when they set up a new device. With the Android “M” release, Android Backup has evolved to include full data, which means all the user data associated with an app will, at last, be restored.

http://developer.android.com/preview/backup/index.html

100 Days of Google Dev / 100 developer videos over 100 days / #GoogleDev100

Subscribe to the Google Developers channel at: http://goo.gl/mQyv5L

Comments (5):

By anonymous    2017-09-20

From Android version: 6.0 (API 23) onward this can easily be achieved as by default Android performs an Auto backup of files. ie Files of the type:

  • Shared preferences files.
  • Files in the directory returned by getFilesDir().
  • Files in the directory returned by getDatabasePath(String), which also includes files created with the SQLiteOpenHelper class.
  • Files in directories created with getDir(String, int).
  • Files on external storage in the directory returned by getExternalFilesDir(String).

Now you can turn this feature on or off by changing the value here in Manifest file:

<application ...
android:allowBackup="true">

This keeps a backup in the users Google Drive, and the space is limited to 25MB and that space is not counted against the user's space quota.

More information regarding this is available here:

More information regarding including and excluding various files from backing up is provided here:

So from API 23 onward you can save the game related info in any of the aforementioned files and not worry about retrieving it later.

Original Thread

By anonymous    2017-09-20

Since Android 6.0 (v 23) onward, Android introduced a new feature called Auto-backup for apps . What this does is, it performs a backup of certain files of an application to a user's Google drive. The list of files it updates include:

  • Shared preferences files
  • Files in the directory returned by getFilesDir()
  • Files in the directory returned by getDatabasePath(String)
  • Files in directories created with getDir(String, int)
  • Files on external storage in the directory returned by getExternalFilesDir(String)

Now this line in the manifest.xml is responsible for it :

android:allowBackup="true"

If you prefer to disable the backup, should you choose to set the value to false.

Furthermore, the data backed up is in a 24 hour interval and Android uses the JobScheduler API for this purpose, so which means a user has no control over the process of data being transferred.

Also, the space for auto-backups is limited to 25MB , and which is not counted against the user's space quota.

Also, you can set to <include> and <exclude> certain type of data being uploaded, for instance you may not need to save a user confidential data, so it is flexible for that as well, more info on that is available at : Android Auto Backup for Apps (100 Days of Google Dev)

Original Thread

By anonymous    2017-09-23

If you are looking for alternative beacuse of autobackup dangers There is a way to exclude specific SharedPrefs you use from autoBackup feature - It is achieved by declaring exclude tags in an xml file and then referring it using the android:fullBackupContent attribute under application tag of your manifest. By doing so you can still support autobackup feature without worring about sensitive information that is stored on Google Drive cloud.

Good references: https://developer.android.com/guide/topics/data/autobackup.html https://www.youtube.com/watch?v=HXacyy0HSW0

Original Thread

Recommended Books

    Popular Videos 2274694

    Submit Your Video

    If you have some great dev videos to share, please fill out this form.