更新时间:2022-06-19 21:16:02
创建自定义 BackupHelper
:
public class DbBackupHelper extends FileBackupHelper {
public DbBackupHelper(Context ctx, String dbName) {
super(ctx, ctx.getDatabasePath(dbName).getAbsolutePath());
}
}
,然后将其添加到 BackupAgentHelper
:
public void onCreate() {
addHelper(DATABASE, new DbBackupHelper(this, DB.FILE));
}