I'm trying to make app close when some uncaughtException
happens, but android show a message to try to restart the application and the application stays in slow motion or just black screen, I made a class to extends in my activity to overriding the method uncaughtException()
to catch logs to send than to sentry.io and using:
public class MyExceptionHandler implements
Thread.UncaughtExceptionHandler {
public MyExceptionHandler(Activity context) {
Thread.setDefaultUncaughtExceptionHandler(this);
}
@Override
public void uncaughtException(final Thread thread, final Throwable ex) {
Log.e("ERROR", ex.toString());
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
}