Created
February 5, 2016 06:37
-
-
Save pookie13/b1a649676bd3d364600a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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