carp_background_location
4.0.0, released 3 years ago by cachet.dk
Background location tracking for Android and iOS using background_locator_2
What it does
Provides continuous location updates even when the app is in the background. It is a thin wrapper around the background_locator_2 plugin, exposing a simple API for configuring intervals, distance filters, and notifications.
AI-written summary of version 4.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Need persistent location updates in background
- Building health or fitness tracking apps
- When the app must keep running after being killed by the OS
Skip it when
- Only foreground location is required
- When you prefer to handle permissions and location logic yourself
Strengths
- Works in background on both Android and iOS
- Simple API with singleton pattern
- Cross‑platform support via background_locator_2
Weaknesses
- Requires manual permission setup on Android 11+
- Relies on background_locator_2 which may have its own limitations
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 1
Add Android permissions (INTERNET, ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION, WAKE_LOCK, FOREGROUND_SERVICE, RECEIVE_BOOT_COMPLETED) and receiver/service entries. Add iOS Info.plist keys (NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationAlwaysUsageDescription, NSLocationWhenInUseUsageDescription, UIBackgroundModes). Override AppDelegate.swift to register the plugin. No build_runner needed.
```dart
// configure the location manager
LocationManager().interval = 1;
LocationManager().distanceFilter = 0;
LocationManager().notificationTitle = 'CARP Location Example';
LocationManager().notificationMsg = 'CARP is tracking your location';
// start listening to location updates
StreamSubscription<LocationDto> sub = LocationManager()
.locationStream
.listen((loc) => print(loc));
// stop
sub.cancel();
LocationManager().stop();
```Alternatives
Packages that do the same job and could replace carp_background_location.
- location_web
Web implementation of the location plugin for Flutter web.
74Compare - flutter_background_geolocation
Background location tracking and geofencing for iOS and Android
89Compare - tracelet
Production-grade background geolocation and tracking plugin for Flutter.
85Compare - geolocator
Cross-platform plugin to access device GPS, location updates, and coordinate calculations.
97Compare
Works with
Packages commonly used together with carp_background_location: ones it builds on, ones built on it, and its own family.