236
background execution
also BGTask, foreground service
The OS suspends your app. A timer is not a background job.
What is background execution?
Background execution is whatever the OS still lets you do after the user leaves: a scheduled refresh, a processing task, a silent push, an Android foreground service with a visible notification and a declared type. A JavaScript interval stops when the process is suspended. Infinite background work is not a permission you can take.
Why does background execution matter when vibe coding?
Generated apps start a setInterval for sync and a WebSocket “so chat stays live.” iOS freezes both a minute after backgrounding. The user thinks sync is broken.
How do you do background execution?
Name the OS API that is allowed to run. Finish quickly. On Android, a foreground service needs a notification and a type. Persist the work so a killed process can resume.
How do you ask a model for background execution?
Run (work) with (BGTask or a foreground service), not a timer. It must survive the app being suspended. Show the required notification on Android. Persist progress so a kill can resume.
What goes wrong with background execution?
A foreground service with no notification, or the wrong service type. Current Android kills it.