How iOS 12 Manages Background Tasks to Save Battery
iOS 12 employs an intelligent, resource-aware approach to background task scheduling, balancing app updates with energy efficiency. By moving away from unrestricted background execution, Apple designed the operating system to tightly control when, how, and for how long apps can run once a user leaves them. Through predictive scheduling heuristics, batched network activity, energy budgets, and constrained execution windows, iOS 12 minimizes CPU wakeups and radio usage to preserve overall battery life.
The App State Model and Fast Suspension
In iOS 12, an app transitions from the foreground to an inactive state, then quickly into a suspended state. When suspended, an app remains in device memory (RAM) but executes no code and consumes zero CPU cycles.
If an app requires additional time to finish an ongoing task when the
user exits, it must explicitly request extra time using the
beginBackgroundTask(expirationHandler:) API. In iOS 12,
Apple reduced the grace period for completing these tasks—lowering it
from the several minutes allowed in older iOS versions down to
approximately 30 seconds. If an app fails to finish its work within this
window, the system terminates it immediately to prevent background
battery drain.
On-Device Predictive Scheduling
A central pillar of battery preservation in iOS 12 is on-device machine learning that learns user behavior patterns:
- Usage Forecasting: The system monitors when a user typically opens specific apps. If a user consistently checks a news app at 8:00 AM, iOS 12 schedules the app’s background fetch to occur shortly before that time, rather than updating it continuously throughout the night.
- Frequency Modulation: Apps that are rarely opened are demoted in scheduling priority, receiving fewer system wakeups and significantly reduced background execution time.
Discretionary Transfers and Network Batching
Radio transmitters (cellular and Wi-Fi) consume substantial power when ramping up from an idle state to transmit data. iOS 12 avoids repeatedly powering up the network chip through request batching and discretionary task scheduling.
Using URLSessionConfiguration.background, developers
hand off upload and download tasks directly to the operating system
daemon (nsurlsessiond). iOS 12 marks tasks as
"discretionary," allowing the system to delay them until optimal
operating conditions are met. The system prioritizes executing these
tasks when:
- The device is connected to an unmetered Wi-Fi network.
- The device is plugged into a charger.
- The screen is off and the battery level is sufficiently high.
By coalescing multiple background network requests from various apps into a single transmission window, iOS 12 allows the hardware to return to a low-power sleep state more rapidly.
Strict Background Modes and Push Throttling
iOS 12 restricts ongoing background execution to strictly defined Background Execution Modes, including audio playback, turn-by-turn navigation, and VoIP services. Apps without these entitlements cannot run persistent background threads.
For data updates, iOS 12 relies on remote silent notifications (using
the content-available: 1 payload). However, the operating
system treats these push notifications as suggestions rather than strict
commands. If an app sends too many silent pushes, or if the device is in
a low-power state, iOS 12 throttles or drops the background fetch
entirely, preventing server-driven battery exhaustion.
Centralized Resource Budgeting
iOS 12 actively monitors the system impact of background work through dynamic resource budgeting. Every background-capable app is assigned an internal energy budget determined by device battery percentage, thermal state, and current Low Power Mode status. If an application consistently exhausts its execution allowance or causes excessive CPU wakeups, iOS 12 restricts its ability to run in the background until the device is recharged.