如何指定不允许使用 android:dataExtractionRules 和
how to specify to not allow any data backup with android:dataExtractionRules and
我目前的 android 申请目标是 12 岁及以上。
我不想允许任何类型的备份并且当前有这些清单设置
android:allowBackup="false"
android:fullBackupContent="false"
但是 android:allowBackup="false"
设置现在给出以下警告
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.
我查看了 android:dataExtractionRules
xml 和 none 的示例,其中展示了如何配置 allowBackup="false"
.
的等效项
我错过了什么?
使用android:dataExtractionRules
xml
是否可以达到allowBackup="false"
将 dataExtractionRules
属性添加到您的 AndroidManifest.xml 文件并引用 data_extraction_rules.xml 文件:
<application
android:allowBackup="false"
android:fullBackupContent="false"
android:dataExtractionRules="@xml/data_extraction_rules"
...>
然后,排除所有可能用于云备份和d2d传输的域,更新或创建一个文件app/src/main/res/xml/data_extraction_rules。xml:
<data-extraction-rules>
<cloud-backup>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</cloud-backup>
<device-transfer>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</device-transfer>
</data-extraction-rules>
dataExtractionRules
属性 is available 用于 API 31(Android 12)及更高。保留 API 31.
之前的 Android 版本的 allowBackup
和 fullBackupContent
属性
Note to maybe silence "Attribute
dataExtractionRules is only used in API level 31 and higher (current min is 19)
" warning, with tools:targetApi="s"
attribute as well (because older platforms simply ignore manifest-attributes they don't support, and the warning is useless).
我目前的 android 申请目标是 12 岁及以上。
我不想允许任何类型的备份并且当前有这些清单设置
android:allowBackup="false"
android:fullBackupContent="false"
但是 android:allowBackup="false"
设置现在给出以下警告
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.
我查看了 android:dataExtractionRules
xml 和 none 的示例,其中展示了如何配置 allowBackup="false"
.
我错过了什么?
使用android:dataExtractionRules
xml
allowBackup="false"
将 dataExtractionRules
属性添加到您的 AndroidManifest.xml 文件并引用 data_extraction_rules.xml 文件:
<application
android:allowBackup="false"
android:fullBackupContent="false"
android:dataExtractionRules="@xml/data_extraction_rules"
...>
然后,排除所有可能用于云备份和d2d传输的域,更新或创建一个文件app/src/main/res/xml/data_extraction_rules。xml:
<data-extraction-rules>
<cloud-backup>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</cloud-backup>
<device-transfer>
<exclude domain="root" />
<exclude domain="file" />
<exclude domain="database" />
<exclude domain="sharedpref" />
<exclude domain="external" />
</device-transfer>
</data-extraction-rules>
dataExtractionRules
属性 is available 用于 API 31(Android 12)及更高。保留 API 31.
allowBackup
和 fullBackupContent
属性
Note to maybe silence "
Attribute
dataExtractionRulesis only used in API level 31 and higher (current min is 19)
" warning, withtools:targetApi="s"
attribute as well (because older platforms simply ignore manifest-attributes they don't support, and the warning is useless).