Skip to content

Instantly share code, notes, and snippets.

@pookie13
Created February 5, 2016 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pookie13/b1a649676bd3d364600a to your computer and use it in GitHub Desktop.
Save pookie13/b1a649676bd3d364600a to your computer and use it in GitHub Desktop.
in Application class
@Override
public void uncaughtException(Thread thread, Throwable throwable) {
//throwable will tell you the resion of crash
PendingIntent pendingIntent = PendingIntent.getActivity(getBaseContext(), 0,
new Intent(this, WelcomeActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);//pass Activity that you want to start at fatal.
AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 500, pendingIntent);
System.exit(2);
}
and implements Thread.UncaughtExceptionHandler to Application class..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment