The Android Application submits the crash report.

Source: Internet
Author: User

Why do we need feedback on the crash report?

 

Android applicationsProgramTo avoid crash. Although zero-crash is the ultimate goal pursued by programmers, the reality is that programmers can only minimize the occurrence of crash, and it is almost impossible to completely eliminate it. Maybe you think that your application is almost perfect and can easily withstand the devil's test in the testing department. But when your application is released to the market, it may not be so lucky to face millions or even tens of millions of users.

For the above reasons, a crash feedback mechanism is required for general applications. Based on the feedback, the programmer canCodeTo make the next version more stable.

 

How to provide feedback?

 

First, let's take a look at how to capture the occurrence of crash.

 

There is an interface in Java, uncaughtexceptionhandler. first look at the description.

Static Interface

Thread. uncaughtexceptionhandler 
WhenThreadWhen an uncaptured exception is suddenly terminated, the handler interface is called.

 

Let's take a look at a method in the Thread class.

Static void

Setdefaultuncaughtexceptionhandler(Thread. uncaughtexceptionhandlerEh) 
Sets the default handler that is called when the thread is suddenly terminated because no exception is caught and no other handler is defined for the thread.

 

After reading these APIs, we can see that we need to implement such an interface and then set the handler in the main thread of the program.

 

 

Public ClassDefaultexceptionhandlerImplementsUncaughtexceptionhandler {// inherits from uncaughtexceptionhandler

 

Public VoidUncaughtexception (thread, throwable ex ){} // Handle exceptions that are not captured

}

 

 

1. send an email

2. Send to server

3. Wait...

In this way, we can handle the crashreport on the mobile phone to see what problems the user has encountered.

Related Article

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.