Goodbye background-fetch, hello expo-background-task

ProductDevelopment6 minutes read

Christian Falch

Christian Falch

Engineering

Expo SDK 53 introduces expo-background-task, a modern way to run background tasks reliably using system APIs for faster, fresher app experiences.

Goodbye background-fetch, hello expo-background-task

Slow app startups usually happen because work that could run later happens too early. With Expo’s new BackgroundTask library, you can move updates to the background and deliver a smoother experience.

Expo SDK 53 introduces a modernized background task solution with the new expo-background-task library which replaces and deprecates the old expo-background-fetch library. This new library uses updated, system-supported APIs on both iOS and Android, ensuring efficient background task execution with minimal impact on battery and system resources.

Introducing Expo BackgroundTask

You can use expo-background-task to perform things like downloading new app versions with Expo Updates or refreshing API data, so users always launch your app with the latest content. The old expo-background-fetch relied on deprecated iOS APIs (Background Fetch was deprecated in iOS 13) and a mix of JobScheduler and AlarmManager on Android.

In expo-background-task we've moved to using the new BGTaskScheduler API on iOS, and the new WorkManager API on Android - both created specifically for running tasks in the background. These APIs were designed for background work, offering more reliability and better power management.

Our implementation hooks into these APIs using a single native task on each platform. That task runs one or more JS tasks registered through expo-task-manager, and it only runs when the app is backgrounded.

Expo Background Task best practices

What you can do with Expo BackgroundTask

The expo-background-task library aligns well with modern application expectations: fast startup, fresh content, always up-to-date.

You can use it to:

  • Check for and download updates with expo-updates
  • Upload local data to your server
  • Download fresh content to cache for next app launch
  • Run background clean-up or optimization jobs

Tasks are configured to require network connectivity before execution, so you can safely call online services from within your tasks.

How it works

Expo BackgroundTask works by letting you define Javascript tasks that will be run when your app is in the background. You'll be using it with the expo-task-manager library for managing and persisting tasks just like in expo-background-fetch, and it supports multiple tasks that will be run sequentially.

Each task must be defined in the top level scope so that it is registered even if your app is started from the background - this is the same requirement as in all of our libraries using expo-task-manager:

Code
import * as BackgroundTask from 'expo-background-task';
import * as TaskManager from 'expo-task-manager';
TaskManager.defineTask('MY_TASK', async () => {
// Your background task implementation goes here
});

After the task has been defined you decide where in your code to activate it by registering the task. After the task has been registered it will be run at intervals defined by the options passed to the registerTask function:

Code
function registerTask() {
await BackgroundTask.registerTaskAsync('MY_TASK', {
minimumInterval: 12 * 60, // 12 hours
});
}

Now all you have to do is let the background task run and do its magic!

Here is a quick example of how to check for updates using Expo Update from within a background task:

Code
import * as BackgroundTask from 'expo-background-task';
import * as TaskManager from 'expo-task-manager';
import * as Updates from "expo-updates";
TaskManager.defineTask('MY_TASK', async () => {
const update = await Updates.checkForUpdateAsync();
if (update.isAvailable) {
await Updates.fetchUpdateAsync();
await Updates.reloadAsync()
}
});

More info here: https://docs.expo.dev/eas-update/download-updates/#checking-for-updates-while-the-app-is-backgrounded

Constraints

Note: Background task execution is ultimately controlled by the OS, depending on device state and user behavior (e.g., force quitting the app). Check the docs for platform-specific behavior. There are some subtle details regarding how iOS and Android handles the app being killed by the user, you can read more about it in our documentation.

Why BackgroundTask matters for Expo developers

Reliable background tasks unlock a better user experience and enable new kinds of apps.

  • Faster startup experiences: Apps can pre-load data, cache content, and apply updates before the user even opens the app, leading to near-instant launch times and fresher interfaces.
  • More resilient apps: Local-first and offline-first designs become easier when background tasks can periodically sync and clean up data without relying on the user to manually refresh.
  • Modern platform alignment: By using system-supported APIs like BGTaskScheduler and WorkManager, your app behaves like a "first-class citizen" on iOS and Android, leading to better reliability and battery friendliness — and avoiding penalties from OS-level task throttling.
  • Lower maintenance burden: Unlike old background-fetch solutions that relied on deprecated, brittle APIs, Expo Background Task is built on stable, modern foundations that will last across OS updates.
  • Better foundation for future features: Having a robust, native-aligned background task system also sets the stage for Expo to introduce even more powerful background capabilities in the future.

Background work is becoming a standard expectation for high-quality apps — and with Expo BackgroundTask, you get it in a way that’s simple, reliable, and built for the future.

Migration path

The API for expo-background-task is nearly identical to expo-background-fetch. Most changes are drop-in, aside from minor adjustments to registerTaskAsync function's option parameter. Migration should be quick and easy.

Try it out!

We'd love it if you give expo-background-task a try and let us know what you think. Your feedback is invaluable to us.

Docs: https://docs.expo.dev/versions/v53.0.0/sdk/background-task/
Repo: https://github.com/expo/expo/tree/main/packages/expo-background-task

React Native
SDK 53
background task
mobile development
offline first
local first

Dive in, and create your first Expo project

Learn more