code
//获取当前应用的包名和类名 String packageName = getPackageName(); String className = getClass().getName(); //创建Intent Intent intent = new Intent(curAct, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); //创建PendingIntent PendingIntent pendingIntent = PendingIntent.getActivity(curAct, 0, intent, PendingIntent.FLAG_ONE_SHOT); //通过PendingIntent启动Activity AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); manager.set(AlarmManager.RTC, System.currentTimeMillis() + 1000, pendingIntent); System.exit(0);
标签:app,AlarmManager,FLAG,Intent,ACTIVITY,intent,android,重启,PendingIntent From: https://www.cnblogs.com/xsj1989/p/17897469.html