Firstly, I know that one should not really kill/restart an application on Android. In my use case, I want to factory-reset my application in a specific case where a server s
I had to add a Handler to delay the exit:
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 200, mPendingIntent); final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Runtime.getRuntime().exit(0); } }, 100);