Handling Errors in Android


I want all exceptions that can occur in the application while the user is running to be sent to the Andoid Developer Console. Let's say that information about an exception is sendFeedback() using the sendFeedback() method. And here the question arises: where should this sendFeedback() method be located, taking into account the fact that this method will be used throughout the application? And how do you use it? I have two assumptions:

  1. in the Application class (and then, in each catch -e of each try-catch call this method)
  2. in a class that implements the java.lang.Thread.UncaughtExceptionHandler interface (and then call Thread.setDefaultUncaughtExceptionHandler(...) in each Thread.setDefaultUncaughtExceptionHandler(...) )

How correct is this? Or are both bad, and better done in some other way?


Why don't you use a ready-made solution like https://fabric.io ? It connects it to its application, and from all devices begins to receive statistics about falls. Very handy little thing

Scroll to Top