use of org.acra.file.BulkReportDeleter in project acra by ACRA.
the class ApplicationStartupProcessor method deleteUnsentReportsFromOldAppVersion.
/**
* Delete any old unsent reports if this is a newer version of the app than when we last started.
*/
public void deleteUnsentReportsFromOldAppVersion() {
final SharedPreferences prefs = new SharedPreferencesFactory(context, config).create();
final long lastVersionNr = prefs.getInt(ACRA.PREF_LAST_VERSION_NR, 0);
final int appVersion = getAppVersion();
if (appVersion > lastVersionNr) {
final BulkReportDeleter reportDeleter = new BulkReportDeleter(context);
reportDeleter.deleteReports(true, 0);
reportDeleter.deleteReports(false, 0);
final SharedPreferences.Editor prefsEditor = prefs.edit();
prefsEditor.putInt(ACRA.PREF_LAST_VERSION_NR, appVersion);
PrefUtils.save(prefsEditor);
}
}
Aggregations