Zygote
How apps work

Background work

The long war between apps that want to run and batteries that die.

5 pages57 min5 interactive7900 words
  1. 01The history of background workFor ten years Android let apps run background services forever. Then the battery data came in, and the platform spent a decade adding restriction after restriction — each one closing a door the previous one opened.intermediate12 mininteractive
  2. 02Choosing the right APICoroutine, WorkManager, foreground service, AlarmManager, JobScheduler: five answers to five different questions. The first question is not which API is best — it is how long the work must survive.intermediate11 mininteractive
  3. 03WorkManager internalsWorkManager looks like a simple enqueue API. Underneath it is a SQLite database, a constraint-aware scheduler and a JobService, and understanding that stack explains why your work did not run when you expected.nerd11 mininteractive
  4. 04Foreground servicesA foreground service is a contract with the user: you may keep running, and in exchange you must say what you are doing. Since Android 14 the contract has a type, a permission and, for some types, a deadline.intermediate12 mininteractive
  5. 05Push messagingWhy every Android app shares one push connection, why that connection is the only reliable way to wake a sleeping phone, and why high-priority messages are a budget rather than a setting.intermediate11 mininteractive

Test yourself

Test yourself: Background work

1 / 8

Match each foreground service type to its constraint.

dataSync
camera
mediaPlayback
specialUse
0 answered · 0 correct