It works on Android 5.0, but it won't work on Jellybean devices.
@ReportsCrashes(
formKey = "", // This is required for backward compatibility but not used
formUri = "dummyurl",
reportType = org.acra.sender.HttpSender.Type.JSON,
httpMethod = org.acra.sender.HttpSender.Method.PUT,
formUriBasicAuthLogin="adminTest",
formUriBasicAuthPassword="adminTest",
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash_toast_text)
public class Application extends Application {
@Override
public void onCreate() {
super.onCreate();
init();
ACRA.init(this);
Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
}
private UncaughtExceptionHandler sUncaughtExceptionHandler = new UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.i(LogTag, "uncaughtException: ");
dummyMethod();
Thread.getDefaultUncaughtExceptionHandler().uncaughtException(
thread, ex);
}
};
}
ACRA sets its own UncaughtExceptioHandler that performs the error reporting and then delegates to any UncaughtExceptionHandler that existed before it.
So if you want your UncaughtExceptionHandler to be called once ACRA has completed the error reporting, then you need to set your exception handler before calling ACRA.init(this);
Since you are sending Toast notifications you also need to set forceCloseDialogAfterToast
as the assumption is that the defaultExceptionHandler is the one from Android framework that will display a force close dialog and you wouldn't want to show that if also showing a Toast.