Background Job Execution
Background job execution describes how a mobile operating system schedules, grants CPU time to, and enforces constraints on work that runs while an app is not in the foreground.
Background job execution describes how a mobile operating system schedules, grants CPU time to, and enforces constraints on work that runs while an app is not in the foreground.
Both iOS and Android have tightened background execution rules substantially over the past several OS generations to protect battery life. Apps can no longer run arbitrary background threads indefinitely. Instead, they must register specific task types with the OS scheduler: periodic background fetch (refreshing data on a schedule), background processing tasks (longer-duration work like ML model updates or database migrations), and silent push-triggered background tasks (where an incoming notification wakes the app briefly to pre-fetch content).
The OS scheduler grants a background execution window based on device conditions: battery level, thermal state, whether the device is charging, and historical app usage patterns. On iOS, BGAppRefreshTask gets roughly 30 seconds; BGProcessingTask can run for several minutes but only when the device is charging and idle. Android's WorkManager uses similar heuristics through the JobScheduler and AlarmManager APIs.
When the app receives the background execution window, it must register an expiration handler immediately. This handler is called if the OS needs to reclaim resources before the task finishes. On expiration, the app must save partial progress and signal task completion. Failing to call the completion handler leaves the system unable to accurately schedule future background windows, degrading reliability.
For patterns that work with background sync, see Offline Sync Workflow and Mobile API Sync. For full app lifecycle context, see App Launch Lifecycle.