I found a way to do this cleanly and it checks well. be careful with Crashlytics.log to send logs during crash reports. doesn't seem to work consistently on Crashlytics version 2.3.14.151. Instead, I use Crashlytics.setString (key, value). crashlytics.log seems to work fine with crashlytics.logException (..).
another question I had was whether he would work on exceptions to the ashram. Answer: yes, I experienced it myself.
therefore, it captures all exceptions from all threads.
The rest of the idea is similar to here . Man uses the decorator pattern over the standard ExceptionHandler to add functionality to the uncaughtException method.
Here is how I improved it:
public class DefaultUnCaughtExceptionHandlerDecorator implements UncaughtExceptionHandler { private UncaughtExceptionHandler mDefaultUncaughtExceptionHandler;
}
now in your subclass of the Application AFTER crashlytics class the following is installed:
Thread.setDefaultUncaughtExceptionHandler(new DefaultUnCaughtExceptionHandlerDecorator(Thread.getDefaultUncaughtExceptionHandler()));
source share