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.
This commit is contained in:
Jose Olarte III
2026-02-24 19:19:22 +08:00
parent 7188d32ae6
commit 25f83cf1fa
2 changed files with 12 additions and 9 deletions

View File

@@ -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}")
}

View File

@@ -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)