Skip to the page

Push notifications and background work · senior

Background tasks and background location

Mobile operating systems decide when your app may run in the background: iOS BGTaskScheduler and Android WorkManager run tasks opportunistically (Android at most every 15 minutes, iOS with no guaranteed time), long-running work needs an Android foreground service with a declared type, and background location needs extra permissions, store declarations and battery care.

The notes

What you must know

  • expo-background-task uses WorkManager (Android) and BGTaskScheduler (iOS): minimumInterval at least 15 min on Android, default 12 h; define the task at module scope with TaskManager.defineTask; it does not run on the iOS simulator and stops when the user kills the app. expo-background-fetch is deprecated.
  • iOS: no guaranteed interval; tasks do not run after a force-quit; silent pushes are throttled. Always design "sync on next open" as the fallback.
  • Android: WorkManager survives reboots and supports constraints (network, charging). Foreground services need a type (location, dataSync…) and a matching permission since Android 14; apps targeting Android 15 cannot start a dataSync foreground service from BOOT_COMPLETED.
  • Background location: Android needs foreground location first, then background location granted separately (via Settings on Android 11+), a location foreground service and a Play Console declaration; iOS needs "Always" authorisation and allowsBackgroundLocationUpdates.
  • Battery: distance filters, activity-based intervals, batched uploads, geofences or significant-change updates instead of constant GPS.
  • OEM battery savers (Xiaomi, Oppo, Vivo) kill background work; guide users to the right settings when tracking really matters (delivery partners).

The red pen

Common traps: mistake → fix

  • Mistake: "My sync will run exactly every 15 minutes on iOS"

    Fix: iOS decides when; nothing is guaranteed.

  • Mistake: "Ask for background location on first launch"

    Fix: ask for foreground first, explain, then ask for background.

  • Mistake: "Start a foreground service without a type"

    Fix: it crashes on Android 14+.

Easy to hard

Questions interviewers ask, easy to hard

  1. Sync pending data every 15 minutes even when the app is closed: what can you guarantee on iOS vs Android?
  2. What is headless JS?
  3. Walk me through what Android 14+ and iOS require for background location.
  4. An OEM battery saver keeps killing the tracking service. What do you do?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview