So I was adding some stuff to my application manifest and I saw that I had a warning on my application tag:
On SDK version 23 and up, your app data will be automatically backed up and restored on app install. Consider adding the attribute android:fullBackupContent to specify an @xml resource which configures which files to backup.
And then I searched up for that. Apparently there are only 2 tags for that: <include>
and <exclude>
. I don't want to exclude any files from the backup as I don't have any local-depending files, and I don't need any <include>
tags as
<include>:
Specifies a set of resources to back up, instead of having the system back up all data in your app by default.
When I saw that if I don't put any <include>
tags, then the system will back up all data in your app by default
, which is exactly what I want.
Now I have this question: should I add the backup_content.xml
file, but empty as the default settings are good, or not add the file at all? (in which case Android Studio will complain)
For this we have android:fullBackupContent in the application tag, which points to a XML file that contains full backup rules for Auto Backup. These rules determine what files get backed up.
xml file in android. The AndroidManifest. xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
The allowBackup attribute determines if an application's data can be backed up and restored, as documented here. By default, this flag is set to true . When this flag is set to true , application data can be backed up and restored by the user using adb backup and adb restore .
Fast Solution:
AndroidManifest.xml
<application android:allowBackup="true" android:fullBackupContent="true" ... ... ... </application>
For more details see: https://developer.android.com/guide/topics/data/autobackup
If you want to silence the warnings, but don't need to exclude any files from the backup, you could also just add tools:ignore="AllowBackup"
to the application
tag in your AndroidManifest.xml
to suppress the warning (or use the Suppress
button that you get when viewing the warning details).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With