5
I am looking for a way (efficient and practical) to capture globally all Exceptions not dealt with by the application (the ones that lead the application to crash or "Application stopped working!").
Questions:
- Is there any method
void main()
, as in Java I can capture these exceptions on a centralised basis before application crash? - There is some feature available in the Android API, for these purposes?
- What would be the most efficient and practical way to create this resource?
I would like an implementation solution, I would not like to use third-party libraries. Because I believe that my final implementation would be something very unique and specific. = D
Additional information: What should be possible to do in the global Exceptions catcher (Accessible resources) (It is not necessary to implement these cases in the response (it is only information needed for continuity of implementation)):
- Capture the Exception Stack;
- Can instantiate and use the package
java.io
; (for recording logs in archive)- (Optional) Have access to
Context
of the application, in order to instantiate a connection to Sqlite; (for recording the logs in a database)
Obs: I do not want to try to recover the application, but only to have this information so that I can analyse it and improve the efficiency of the application.
Detail: I have seen this question here at Sopt and did not assist me in my doubt.
Yes Fernando, have a way to do, I will create an answer soon.
– Wakim
For sure the Wakim should detail very well a solution, that I believe pass by: Thread.setDefaultUncaughtExceptionHandler()
– Paulo Rodrigues