jinwook1469 / acra

Automatically exported from code.google.com/p/acra
0 stars 0 forks source link

Provide a quiet recovery from uncaught exception #77

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When using ACRA's silent reporting, it is often undesirable to have Android's 
standard force-close dialog show up.

It would be helpful to be able to configure ACRA to restart the application, or 
finish() the current activity, or more generally specify a secondary uncaught 
exception handler to be invoked after the report has been sent.When using 
ACRA's silent reporting, it is often undesirable to have Android's standard 
force-close dialog show up.

It would be helpful to be able to configure ACRA to restart the application, or 
finish() the current activity, or more generally specify a secondary uncaught 
exception handler to be invoked after the report has been sent.

Original issue reported on code.google.com by npeer2...@gmail.com on 8 Sep 2011 at 5:20

GoogleCodeExporter commented 8 years ago
One possible workaround is to replace the default uncaught exception handler 
right before ACRA gets initialized in your Application-derived class:

Thread.setDefaultUncaughtExceptionHandler(sUncaughtExceptionHandler);
ACRA.init(this);

And then define:

private static UncaughtExceptionHandler sUncaughtExceptionHandler = new 
UncaughtExceptionHandler() {

    @Override
    public void uncaughtException(Thread thread, Throwable ex) {
        android.os.Process.killProcess(android.os.Process.myPid());
            System.exit(10);
    }
};

Original comment by npeer2...@gmail.com on 9 Nov 2011 at 6:48

GoogleCodeExporter commented 8 years ago
I don't think it is a good idea to simply restart the application. Your user 
was doing something, it did not work as expected and he certainly will see some 
awkward behavior from your app. You would better consider using the TOAST mode 
instead to let your users know that something went wrong without displaying the 
hated Force Close dialog.

Kevin

Original comment by kevin.gaudin on 2 Jan 2012 at 9:44