From 25f83cf1fab1e6ccdce1c611af0cc770181a2da6 Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Tue, 24 Feb 2026 19:19:22 +0800 Subject: [PATCH] fix(android): always reschedule alarm on boot by skipping PendingIntent idempotence Boot recovery was skipping reschedule when it found an "existing" PendingIntent. AlarmManager alarms are not guaranteed to persist across reboot; on devices that clear them, the skip caused the next notification (initial or rollover) to never fire until the app was opened. Pass skipPendingIntentIdempotence = true for all BOOT_RECOVERY call sites (BootReceiver, ReactivationManager.rescheduleAlarmForBoot) so the alarm is always re-registered after reboot. Setting the same PendingIntent again replaces any existing alarm, so no duplicate alarms. --- .../timesafari/dailynotification/BootReceiver.kt | 7 ++++--- .../dailynotification/ReactivationManager.kt | 14 ++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/com/timesafari/dailynotification/BootReceiver.kt b/android/src/main/java/com/timesafari/dailynotification/BootReceiver.kt index 2aadae7..f12821d 100644 --- a/android/src/main/java/com/timesafari/dailynotification/BootReceiver.kt +++ b/android/src/main/java/com/timesafari/dailynotification/BootReceiver.kt @@ -88,11 +88,12 @@ class BootReceiver : BroadcastReceiver() { priority = "normal" ) NotifyReceiver.scheduleExactNotification( - context, - nextRunTime, + context, + nextRunTime, config, scheduleId = schedule.id, - source = ScheduleSource.BOOT_RECOVERY + source = ScheduleSource.BOOT_RECOVERY, + skipPendingIntentIdempotence = true ) Log.i(TAG, "Rescheduled notification for schedule: ${schedule.id}") } diff --git a/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt b/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt index dccdc3b..8e0da52 100644 --- a/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt +++ b/android/src/main/java/com/timesafari/dailynotification/ReactivationManager.kt @@ -308,11 +308,12 @@ class ReactivationManager(private val context: Context) { ) NotifyReceiver.scheduleExactNotification( - context, - nextRunTime, + context, + nextRunTime, config, scheduleId = schedule.id, - source = ScheduleSource.BOOT_RECOVERY + source = ScheduleSource.BOOT_RECOVERY, + skipPendingIntentIdempotence = true ) // Update schedule in database (best effort) @@ -1080,11 +1081,12 @@ class ReactivationManager(private val context: Context) { ) NotifyReceiver.scheduleExactNotification( - context, - nextRunTime, + context, + nextRunTime, config, scheduleId = schedule.id, - source = ScheduleSource.BOOT_RECOVERY + source = ScheduleSource.BOOT_RECOVERY, + skipPendingIntentIdempotence = true ) // Update schedule in database (best effort)