Home > Net >  how to specify to not allow any data backup with android:dataExtractionRules and
how to specify to not allow any data backup with android:dataExtractionRules and

Time:12-16

My current android application targets 12 and higher.

I do not want to allow backup of any type and currently have these manifest settings

    android:allowBackup="false"
    android:fullBackupContent="false"
    

however the android:allowBackup="false" setting gives the following warning now

The attribute android:allowBackup is deprecated from Android 12 and higher and may be removed in future versions. Consider adding the attribute android:dataExtractionRules specifying an @xml resource which configures cloud backups and device transfers on Android 12 and higher.

Ive looked at the examples for android:dataExtractionRules xml and none of them show how to configure the equivalent of allowBackup="false".

what am i missing?

is it possible to achieve allowBackup="false" with the use of android:dataExtractionRules xml

CodePudding user response:

Starting Android 12, backup configuration is set exclusively through the android:dataExtractionRules xml file.

So if you want to disable backups, tell the xml file that nothing has to be included in the backup, like this:

<data-extraction-rules>
    <cloud-backup>
        <include domain=""/>
    </cloud-backup>
</data-extraction-rules>

Remember that if your minSdkVersion is lower than 31, you need to keep android:allowBackup="false" too.

  • Related