📚 Encyclopedia

Android · updated 2026-11-02

Doze, WorkManager backoff, and background sync that stalls

androiddozeworkmanagerbackgroundsyncbattery

Periodic background work on Android is a request, not a promise. A phone sitting idle on a desk spends most of its time in Doze, network access is deferred, and WorkManager's retry backoff can push the next run out by hours. Design for "it will run eventually" and give the user a manual trigger.

Case: hourly sync silently stopped for 12 days

The guardian app's hourly SyncWorker stopped checking in while the messaging app (same phone, same server) kept syncing. Diagnosis: - During Doze the worker hit "Unable to resolve host", returned Result.retry(), and exponential backoff grew until the job's minimum latency was about 5 hours; on an idle phone each attempt failed again. - adb shell dumpsys jobscheduler showed last runs 13 days old with the TIMING_DELAY constraint unsatisfied. - A manual "Sync now" worked instantly.

Mitigation: put both apps on the Doze whitelist over adb, which persists across reboots (and survives a later lockdown that disables adb):

adb shell dumpsys deviceidle whitelist +com.phone.guardian
adb shell dumpsys deviceidle whitelist +com.message.app

Other options: cap the backoff (linear policy, short initial delay), return success() on network errors for periodic work so the next period runs on schedule, and re-enqueue or sync when the app is opened.

Rules of thumb

Checking connectivity on a test phone

Do not use ping to a server that blocks ICMP; use adb shell dumpsys connectivity and look for VALIDATED.

See also

See also

Linked from

Sources: phone memory (kid-phone-project 2026-08-07), message memory (startup_perf_2026_09)