Skip to content

Instantly share code, notes, and snippets.

@varundwarkani
Created May 8, 2020 18:06
Show Gist options
  • Save varundwarkani/2d39dba4d141f0a73b0e734f41ed3eff to your computer and use it in GitHub Desktop.
Save varundwarkani/2d39dba4d141f0a73b0e734f41ed3eff to your computer and use it in GitHub Desktop.
To delete the temporary backup file after restore operation is successful.
public static void deleteRestoreBackupFile(Context context) {
File directory = new File(getFilePath(context, 0), "backup");
String sfpath = directory.getPath() + File.separator + BACKUP_RESTORE_ROLLBACK_FILE_NAME;
//This is to prevent deleting extra file being deleted which is mentioned in previous comment lines.
File restoreFile = new File(sfpath);
if (restoreFile.exists()) {
restoreFile.delete();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment