private void Initializecrashhandlers () {
This crash handler can take care of anything, but you must close the process at the end if you are
Not throwing a exception back to the default thread exception handler. To does this, we first get the
Original thread handler and pass the exception to the previous thread handler (the
been found to work so far).
Final Thread.uncaughtexceptionhandler Originaldefaultuncaughtexceptionhandler =
Thread.getdefaultuncaughtexceptionhandler ();
Final Thread.uncaughtexceptionhandler Scthreadexceptionhandler = new Thread.uncaughtexceptionhandler () {
@Override
public void uncaughtexception (thread thread, Throwable ex) {
Take care of anything else ...
for (crashable crashable:mcrashables) {
Crashable.onapplicationcrash (Appcontext.get (), Thread, ex);
}
Originaldefaultuncaughtexceptionhandler.uncaughtexception (thread, ex);
}
};
Set an uncaught exception handler to take care of cases where you want to do stuff before app crashes
This is also compatible with HOCKEYAPP.
Thread.setdefaultuncaughtexceptionhandler (Scthreadexceptionhandler);
Exceptionreportingprovider.initialize (Gracefulexceptionhandler.getinstance (), New Exceptionreporter ());
}
Android capture crash