Last active
August 20, 2021 03:00
-
-
Save uphy/7857256 to your computer and use it in GitHub Desktop.
Androidで、アクティビティではなく、アプリケーションレベルの再起動を行う。
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
final Intent i = new Intent(getApplicationContext(), ContentActivity.class); | |
final PendingIntent appStarter = PendingIntent.getActivity(getApplicationContext(), 0, i, 0); | |
final AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE); | |
alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 5000, appStarter); | |
Process.killProcess(Process.myPid()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment