端末再起動時にBOOT_COMPLETEDを受け取れるようにする

This commit is contained in:
tateisu 2023-01-05 16:38:01 +09:00
parent edd2c34fbb
commit 0542f4981d
2 changed files with 6 additions and 0 deletions

View File

@ -78,6 +78,9 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- Android 13以上で BOOT_COMPLETED を受け取るために必要 -->
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<!--suppress AndroidUnknownAttribute -->
<application
android:name=".App1"

View File

@ -18,6 +18,9 @@ class EventReceiver : BroadcastReceiver() {
}
override fun onReceive(context: Context, intent: Intent?) {
log.i("onReceive action=${intent?.action}")
when (val action = intent?.action) {
Intent.ACTION_BOOT_COMPLETED,