Focus timer freezes when app is minimized or phone is locked (Android) #1

Open
opened 2026-10-02 10:55:49 +02:00 by lukas · 0 comments
Owner

Problem

The focus timer stops counting down as soon as the app is minimized or the phone is locked. The whole point of the playlist timer is to pace you while you work hands-free, so a timer that only runs with the screen on is not usable.

Repro

  1. Create any task, start the focus playlist
  2. Minimize the app (or lock the phone)
  3. Wait past the end of the current step → reopen the app

Expected: the timer kept running; finished steps auto-advanced (or at least caught up) and the projected end time is still accurate.
Actual: the timer froze when the app went to background; on return it resumes from the stale value.

Suspected cause (for whoever picks this up)

Countdown is driven by setTimeout ticks in the WebView, which Android suspends in background. The existing Wake Lock only works while the page is visible. Likely fix direction: timestamp-based elapsed-time calculation on resume and/or a native foreground service — not just shorter intervals.

Acceptance

  • Minimizing/locking for N minutes then returning shows the correct remaining time (catch-up, no silent drift)
  • Step transitions that happened in background are announced/marked, not skipped silently
  • Verified on the attached Pixel via release build
## Problem The focus timer stops counting down as soon as the app is minimized or the phone is locked. The whole point of the playlist timer is to pace you while you work hands-free, so a timer that only runs with the screen on is not usable. ## Repro 1. Create any task, start the focus playlist 2. Minimize the app (or lock the phone) 3. Wait past the end of the current step → reopen the app **Expected:** the timer kept running; finished steps auto-advanced (or at least caught up) and the projected end time is still accurate. **Actual:** the timer froze when the app went to background; on return it resumes from the stale value. ## Suspected cause (for whoever picks this up) Countdown is driven by `setTimeout` ticks in the WebView, which Android suspends in background. The existing Wake Lock only works while the page is visible. Likely fix direction: timestamp-based elapsed-time calculation on resume and/or a native foreground service — **not** just shorter intervals. ## Acceptance - [ ] Minimizing/locking for N minutes then returning shows the correct remaining time (catch-up, no silent drift) - [ ] Step transitions that happened in background are announced/marked, not skipped silently - [ ] Verified on the attached Pixel via release build
lukas changed title from Timer doesn't run in Background of android Phone to Focus timer freezes when app is minimized or phone is locked (Android) 2026-10-02 11:35:23 +02:00
lukas added the androidbug labels 2026-10-02 11:35:58 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lukas/mindlist#1