Test several app restart mode, or this way is more reliable;
public class APP extends application implements
thread.uncaughtexceptionhandler{
Context context;
Private Pendingintent Intent; After the app exits, Pendingintent still exists, and after 2 seconds of Setup, restart your main activity
@Override
public void OnCreate () {
Super.oncreate ();
context = this;
Set Thread Exception Handler
Thread.setdefaultuncaughtexceptionhandler (this);
Intent = pendingintent.getactivity (this, 0,new intent (this, mainactivity.class). Addflags (intent.flag_activity_ Single_top), 0);
}
@Override
public void uncaughtexception (thread thread, Throwable ex) {
LOG.E ("TAG", "uncaughtexception");
Alarmmanager mgr = (alarmmanager) getsystemservice (Context.alarm_service);
Mgr.set (ALARMMANAGER.RTC, System.currenttimemillis () +, intent);
System.exit (0);
}
Remember to register your appliction in manifest;
}
App Crash restart