问题
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
?
回答1:
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.
来源:https://stackoverflow.com/questions/57357731/why-androidfullbackuponly-default-value-is-false