📌  相关文章
📜  以编程方式重新启动应用程序 android - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:42.953000             🧑  作者: Mango

代码示例1
Intent mStartActivity = new Intent(context, StartActivity.class);
int mPendingIntentId = 123456;
PendingIntent mPendingIntent = PendingIntent.getActivity(context, mPendingIntentId,    mStartActivity, PendingIntent.FLAG_CANCEL_CURRENT);
AlarmManager mgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100, mPendingIntent);
System.exit(0); //you can also kill your app's process