When I was implementing last activity, a doubt came. My app stores and get some values from DB and SharedPreferences, so, is it possible to clean them if my App crashes or is terminated?
With terminated I mean like someone who goes in "Device Settings" and manually terminates App (or in other way). Maybe by a background check service?
EDIT - SOLVED by myself
Simply handling DefaultUncaughtExceptionHandler inside Application's onCreate:
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, final Throwable ex) {
// here i start a new Activity in which clean and handle what i need)
}