Skip to main content

expo-background-fetch

Version: 55.0.6 Expo universal module for BackgroundFetch API. Allows you to register background tasks that run periodically even when the app is closed or in the background.

Installation

Usage

API Reference

Methods

(taskName: string, options?: BackgroundFetchOptions) => Promise<void>
Registers a background fetch task
(taskName: string) => Promise<void>
Unregisters a background fetch task
() => Promise<BackgroundFetchStatus>
Gets background fetch status
(seconds: number) => Promise<void>
Sets minimum fetch interval (iOS only)

Types

BackgroundFetchOptions

number
Minimum interval in seconds between fetches. Default: 900 (15 min)
boolean
Whether to stop task when app is terminated. Default: true
boolean
Whether to start task on device boot (Android). Default: false

BackgroundFetchResult

Examples

Sync Data in Background

Platform Support

Configuration

app.json

Best Practices

  1. Battery Efficiency: Keep background tasks short
  2. Minimum Interval: Respect system-imposed minimum intervals
  3. Error Handling: Always handle errors gracefully
  4. Return Values: Return appropriate BackgroundFetchResult
  5. Testing: Test on real devices, not simulators
Background fetch intervals are not guaranteed. The system may adjust intervals based on battery, usage patterns, and other factors.

Resources