Android capture crash

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.