Skip to content
pubscout

background_fetch

2.0.1, released 2 days ago by transistorsoft.com

Executes periodic background callbacks on iOS and Android.

WASM-ready
$ flutter pub add background_fetch
Source repository

What it does

Provides a simple plugin to wake the app in the background roughly every 15 minutes and run a user‑provided callback. Supports Android headless mode and iOS background‑fetch limits.

AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to run lightweight code periodically while the app is in the background or terminated (e.g., sync, analytics).
  • You want a cross‑platform solution that works with both Android and iOS without writing native code yourself.

Skip it when

  • Precise timing or intervals shorter than 15 minutes are required.
  • You need guaranteed execution on iOS when the app is terminated.

Strengths

  • Very simple API – just configure and provide a callback.
  • Supports Android headless execution after app termination.
  • MIT licensed and actively maintained.

Weaknesses

  • Cannot fire more frequently than ~15 minutes and OS may throttle further.
  • iOS stops delivering events when the app is terminated or background refresh is disabled.
  • Limited control over exact scheduling.

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
0

Add required permissions to AndroidManifest (e.g., RECEIVE_BOOT_COMPLETED), enable background fetch in iOS (Info.plist) and configure the plugin in native code (AppDelegate/Android Application).

import 'package:background_fetch/background_fetch.dart';

void backgroundFetchHeadlessTask(String taskId) async {
  // Do your work.
  BackgroundFetch.finish(taskId);
}

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask);
  await BackgroundFetch.configure(BackgroundFetchConfig(
    minimumFetchInterval: 15,
    stopOnTerminate: false,
    enableHeadless: true,
  ), (String taskId) async {
    // Your periodic code here.
    BackgroundFetch.finish(taskId);
  });
  runApp(MyApp());
}

Alternatives

Packages that do the same job and could replace background_fetch.

Works with

Packages commonly used together with background_fetch: ones it builds on, ones built on it, and its own family.