警告
AndroidMenifest中application标签下android:allowBackup="true"
时,会警告:
Warning: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. More info: https://developer.android.com/training/backup/autosyncapi.html
警告:在SDKVersion 23和更高版本上,应用程序数据将在应用程序安装上自动备份和恢复。考虑添属性‘android:fullBackupContent’以指定一`@xml‘资源,该资源配置哪些文件要备份。更多信息:https://developer.android.com/training/backup/autosyncapi.html
alt+enter可以添加属性android:fullBackupContent="@xml/backup_descriptor"
并自动在xml包下创建backup_descriptor.xml
在这个xml文件中,可以定义需要备份(include)和不需要备份(exclude)的相关数据,并指定数据保存方式
<full-backup-content>
<include domain=["file" | "database" | "sharedpref" | "external" | "root"] path="string" />
<exclude domain=["file" | "database" | "sharedpref" | "external" | "root"] path="string" />
<exclude domain="database" path="device_info.db"/>
</full-backup-content>