How to identify that the application has stopped working?

0

I need to save some data every time the application closes, I did this by overriding the onStop , onDestroy , onPause and it works, under normal conditions, more when the crash app does not execute none of these override and consequently does not save the data I need.

Would I have identified how the app stopped working (crash)?

    
asked by anonymous 29.08.2017 / 16:06

1 answer

3

The best way is to identify the most sensitive crash points in your app and treat them with try / catch blocks, so you can save data on those points.

try{
  // Executa código "sensível" a travamentos
} catch {
  // Salva os dados da aplicação
}

In addition, as already suggested, make periodic saves, including in methods onDestroy, onPause, etc., as you have already done.

There is no "listener" for crashes in the SDK, so you will have to do these treatments whenever possible.

EDIT: You can try this suggestion to create a custom handler of exceptions that gave this question in StackOverflow in English:

link

    
29.08.2017 / 16:33