21.6 · Energy: CPU wake-ups, timers, radios, location and thermal state

A phone’s battery is spent on a few things: the screen, the radios, the CPU waking up, and the GPS. Most app energy problems are the same mistake: doing work at times the system would rather stay asleep.

Mental model. Energy is power × time. Do less work, do it in batches, and let the system pick the moment when you can.

Where energy goes

CPU, timers, networking, location and the display.

  1. Where does an app’s energy go, and how do timers, networking, location and animation change the battery bill? 21.6.1 · L3
    The big spenders are the CPU and GPU (sustained work, and especially waking from idle again and again), the radios (cellular and Wi-Fi), location (GPS, high…

Adapting

Low Power Mode, thermal state, background work and the tools.

  1. How should an app respond to Low Power Mode and thermal pressure, and how do background work and the tooling fit in? 21.6.2 · L5
    The system tells you when to back off. ProcessInfo.processInfo.isLowPowerModeEnabled says the user has asked to save battery (observe…

More in Performance & energy