我对共享首选项文件名的工作方式有点困惑。我不确定是否隐式添加了任何命名前缀或后缀。
下面的backup.xml文件是否会从自动备份中排除所有“myCustomPref”项目?
backup.xml:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<exclude domain="sharedpref" path="myCustomPref"/>
</full-backup-content>
这是我声明我的backup.xml文件的方式:
<application
android:name=".MRApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup"
...
这是我声明共享pref文件的方式:
SharedPreferences settings = activity.getSharedPreferences("myCustomPref", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("myData", value);
editor.commit();
答案 0 :(得分:0)
而不是:
<exclude domain="sharedpref" path="myCustomPref"/>
做:
<exclude domain="sharedpref" path="myCustomPref.xml"/>