0

I am able to start an activity in UncaughtExceptionHandler on API 24;however, it doesn't work on API 26. I am trying to understand why it isn't working?

Thank you

EDIT:

private Thread.UncaughtExceptionHandler _unCaughtExceptionHandler =
    new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread thread, Throwable ex) {
            final Intent intent = new Intent(getContext(), SomeActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
            startActivity(intent);
        }
    };
  • Please, post a little of your code to give us an idea of how to help you to get this solved – Dinorah Tovar Jul 27 '18 at 17:47
  • API 26 introduced some related changes, are you following the recommended pratice? https://developer.android.com/about/versions/oreo/android-8.0-changes#loue – William Chong Jul 27 '18 at 17:47
  • The only change I think it would affect is: "the system doesn't kill the app when an uncaught exception occurs?", and I am not sure why it is the case? – Thai Q Pham Jul 27 '18 at 18:02
  • Can you please add some more code in your question and error log – Rajshree Tiwari Jul 27 '18 at 18:30
  • What you are trying to do is difficult to get right, given that the app is in an unstable state at the time of the crash. I *strongly* encourage you to use ACRA rather than create your own crash reporting framework. – CommonsWare Jul 27 '18 at 21:15
  • @CommonsWare thank you for the response. I just wanted to know why it's hard in API 26. – Thai Q Pham Jul 30 '18 at 17:50

0 Answers0