diff --git a/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt b/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt index 0b5d0f9..324aabc 100644 --- a/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt +++ b/android/app/src/main/kotlin/es/freetimelab/pluriwave/AlarmScheduler.kt @@ -688,7 +688,16 @@ class AlarmScheduler(private val context: Context) { for (id in prefs().getStringSet(KEY_IDS, emptySet()).orEmpty()) { val spec = readSpec(id) ?: continue try { - scheduleSpec(spec, persistOnSuccess = true) + // Trust the persisted trigger (Dart's own verdict, saved when the + // alarm was last armed) instead of running the native recompute + // engine, which can diverge from Dart and leave the alarm armed + // for the wrong day so it silently never rings (see scheduleSpec + // and scheduleAlarm docs). This path runs on boot, unlock and + // ACTION_MY_PACKAGE_REPLACED (fires on every app update), so a + // recompute here re-broke a correctly-armed alarm on every + // install. A genuinely stale (past) trigger still falls back to + // the native recompute inside scheduleSpec. + scheduleSpec(spec, persistOnSuccess = true, trustDartTrigger = true) Log.d(tag, "alarm.reschedule OK id=$id") } catch (error: Throwable) { Log.e(tag, "alarm.reschedule failed id=$id", error)