DevPrep

All topics › Performance

How do you save battery: background work, location, networking?

Middle PRO

Essence

Energy goes not only into computation but into wakeups: every time the CPU, GPS or radio leaves its sleep state, it runs at high power for a while. An energy-efficient app does work in batches, at a moment convenient for the system, and only when it's really needed.

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store