Registry / workflow / expo-background-fetch

expo-background-fetch

JSON →
library55.0.15jsnpmunverified

Provides a universal API for performing background fetch tasks in Expo and React Native apps, allowing periodic data fetching even when the app is in the background. Current stable version is 55.0.15, updated alongside the Expo SDK release cycle (roughly quarterly). Key differentiators: built on top of iOS BGTaskScheduler and Android WorkManager for reliable execution, integrated with Expo's manifest and permissions system. Unlike bare React Native plugins, handles Expo managed workflow and development builds seamlessly. Supports minimum interval configuration and status callbacks.

npm install expo-background-fetch
INSTALL
IMPORT
SIG · EXPO-BACKGROUND-FE
E
expo-background-fetch
workflowjavascriptv55.0.15
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BackgroundFetch
import * as BackgroundFetch from 'expo-background-fetch'
const BackgroundFetch = require('expo-background-fetch')
ESM-only; CommonJS require will fail in Expo's module resolution.
BackgroundFetch.BackgroundFetchStatus
import { BackgroundFetchStatus } from 'expo-background-fetch'
import { BackgroundFetch } from 'expo-background-fetch' // BackgroundFetch is namespace, not a named export
Import specific types/constants as named exports from the module.
registerTaskAsync
import { registerTaskAsync } from 'expo-background-fetch'
BackgroundFetch.registerTaskAsync('task', {...}) // valid but can be destructured
Recommended to destructure for clarity.
BackgroundFetchResult
import { BackgroundFetchResult } from 'expo-background-fetch'
TypeScript type for task result (NoData, NewData, Failed).

Defines a background fetch task, registers it with a minimum interval, and handles fetch results (NewData/Failed).

import * as BackgroundFetch from 'expo-background-fetch'; import * as TaskManager from 'expo-task-manager'; const BACKGROUND_FETCH_TASK = 'background-fetch-task'; TaskManager.defineTask(BACKGROUND_FETCH_TASK, async () => { try { const response = await fetch('https://example.com/data'); const data = await response.json(); console.log('Background fetch data:', data); return BackgroundFetch.BackgroundFetchResult.NewData; } catch (error) { console.error('Background fetch failed:', error); return BackgroundFetch.BackgroundFetchResult.Failed; } }); async function registerFetchTask() { const status = await BackgroundFetch.getStatusAsync(); if (status === BackgroundFetch.BackgroundFetchStatus.Available) { await BackgroundFetch.registerTaskAsync(BACKGROUND_FETCH_TASK, { minimumInterval: 15 * 60, // 15 minutes in seconds stopOnTerminate: false, startOnBoot: true, }); } } registerFetchTask();
Debug
Known issues
gotchaBackground fetch on iOS requires the 'background fetch' capability and may be throttled by iOS. Minimum interval is not guaranteed.
fix
Set minimumInterval to at least 15 minutes (900 seconds); test on a real device.
affects: >=1.0.0
breakingexpo-background-fetch 11.0.0 removed the 'BackgroundFetch.eventName' export. Use task names directly.
fix
Replace BackgroundFetch.eventName with string literals for task names.
affects: >=11.0.0
deprecatedBackgroundFetch.configureAsync() is deprecated in favor of registerTaskAsync().
fix
Use TaskManager.defineTask() and BackgroundFetch.registerTaskAsync() instead.
affects: >=8.0.0
gotchaAndroid background fetch may not work if app is force-stopped; startOnBoot only re-registers after reboot.
fix
Inform users that background tasks may be killed by the OS; use WorkManager for more control.
affects: >=1.0.0
breakingExpo SDK 44+ requires app.json with 'backgroundFetch' plugin for Android.
fix
Add 'plugins': ['expo-background-fetch'] to app.json.
affects: >=44.0.0
Errors
Common errors & fixes
TypeError: Cannot read properties of undefined (reading 'BackgroundFetchResult')
Using default import instead of namespace import.
fix
Replace 'import BackgroundFetch from ...' with 'import * as BackgroundFetch from ...'
BackgroundFetchStatus not available on iOS simulator
Background fetch is not supported on iOS simulator.
fix
Test on a real device or use Expo's development build with a physical device.
Task 'background-fetch-task' is not defined. Use TaskManager.defineTask to define it.
Trying to register a task without defining it first.
fix
Call TaskManager.defineTask(taskName, handler) before BackgroundFetch.registerTaskAsync().
Background timer is not running because the app is in the background and the background task has been suspended.
Background fetch task may be interrupted by iOS/Android.
fix
Ensure the task is registered with proper options and the device is not in low power mode.
Upgrade
Version history
55.0.15latest on npm
Audit
Dependencies
exporequiredPeer dependency required for Expo module system integration.
Agent activity
16 hits · last 30 days
node
12
OpenAI (training)
1
Resources
expo-background-fetch — npm install expo-background-fetch · libregistry