I'm developing an app which in a case of crash, needs to save some data with the time of the crash. Now, I'm saving the data in onDestroy() like this:
@Override
protected void onDestroy() {
saveState();
super.onDestroy();
}
But whenever I crash my app on purpose, onDestroy() is not called and my data is not saved.
My question is, how can I save my data on a crash? Which approach should I take? Because I need the time of the crash to be also saved, it's mandatory.