androidxmlbackup

Should full backup content xml file be empty or not added at all to include all?


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)


Solution

  • I also struggled the same question and couldn't find an answer. So for backup all, I tried making a backup.xml file like that:

    <?xml version="1.0" encoding="utf-8"?>
       <full-backup-content>
    
       </full-backup-content>
    

    and it works fine.

    EDIT 06/04/21

    Just got an official answer from Google IssueTracker:

    The answer to your question appears at the beginning of the section titled Include and exclude files: "By default, the system backs up almost all app data". In order to back up all supported data, don't include android:fullBackupContent in your manifest file.