Using Java (android but this is a java question ) i have created a default exception handler in the application class like this more or less which was taken from some SO thread:
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
AppInitialization();
}
private void AppInitialization() {
defaultUEH = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(_unCaughtExceptionHandler);
}
private UncaughtExceptionHandler defaultUEH;
// handler listener
private Thread.UncaughtExceptionHandler _unCaughtExceptionHandler = new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
ex.printStackTrace();
// TODO handle exception here
}
};
}
Lets talk about what my goal is. I need to record extra information for crashLytics crash reports. so anytime a exception occurs the hook uncaughtException(Thread thread, Throwable ex) will be called. i assume that will work for crashes and exceptions (not sure).
3 questions on this:
will this affect how crashLytics works since im overrding the default exception handler.
Will this allow the app to continue - i dont want this. i only want to log the exception somewhere else and have it continue as if the defaultexceptionHandler did not exist. Otherwise, QA regression will have a hard time seeing the bugs so we can fix them. If i call defaultUEH.uncaughtException(thread, ex) from within uncaughtException(thread,ex) will it keep looping ?
What thread is associated with setDefaultUncaughtExceptionHandler ? does this work for all threads for example or just main thread ?
So to be clear, i need a way to send additional information on every crashlytics crash/exception. How ?
UPDATE: I see here that someone found a solution but using this method does it make crashlytics report the fatal issues as well ?