Skip to content

Instantly share code, notes, and snippets.

@tw-Frey
Created January 9, 2022 07:45
Show Gist options
  • Select an option

  • Save tw-Frey/6f21add833ebc6bf2b796704bc400a9e to your computer and use it in GitHub Desktop.

Select an option

Save tw-Frey/6f21add833ebc6bf2b796704bc400a9e to your computer and use it in GitHub Desktop.
Android Auto Backup and whatever android:fullBackupOnly is true/false

Why android:fullBackupOnly default value is false?


Cheok Yan Cheng 問道:

In https://developer.android.com/guide/topics/manifest/application-element,

android:fullBackupOnly

This attribute indicates whether or not to use Auto Backup on devices where it is available. If set to true, then your app performs Auto Backup when installed on a device running Android 6.0 (API level 23) or higher. On older devices, your app ignores this attribute and performs Key/Value Backups. The default value is "false".

If the default value is false, does that mean all Android version will prefer legacy Android Backup Service over modern Android Auto Backup?

But, according to https://developer.android.com/guide/topics/data/autobackup

Auto Backup for Apps automatically backs up a user's data from apps that target and run on Android 6.0 (API level 23) or later.

Seem like modern Android Auto Backup is the default choice. If so, why the default value for android:fullBackupOnly is false?


Piyush Gadigone 回答:

The language that is used in documentation is confusing indeed. There are two ways to backup data: Auto-backup and Key-value backup. When you define a BackupAgentHelper in you manifest, you are using Key-value backup.

  • android:fullBackupOnly=true means that you will always do Auto-backup, even if you have a BackupAgentHelper defined in your manifest.
  • android:fullBackupOnly=false means that you do Auto-backup if no BackupAgentHelper is defined, and Key-value when a BackupAgentHelper is defined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment