native_geofence
1.5.1, released 4 weeks ago by chunkytofustudios.com
Battery-efficient native geofencing plugin for iOS and Android.
What it does
Allows your Flutter application to be alerted when the user enters, exits, or dwells in a geographical region. Handles events even when the app is in the background or terminated, and re-registers geofences after device reboot.
AI-written summary of version 1.5.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need location-based triggers like entering or leaving an area
- Geofencing must work when the app is terminated or in the background
- You want battery-efficient native geofencing APIs on iOS and Android
Skip it when
- You only need continuous real-time GPS tracking rather than boundary alerts
- You are not willing to configure native permissions and iOS AppDelegate or Android Manifest settings
Strengths
- Works when application is in foreground, background, or terminated
- Re-registers geofences automatically after device reboot on Android
- Uses native iOS CLLocationManager and Android GeofencingClient APIs
Weaknesses
- Requires manual native configuration in AndroidManifest.xml and iOS AppDelegate/Info.plist
- Does not handle requesting user permissions directly; requires a separate permission plugin
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 2
Requires adding location permissions, broadcast receivers, and foreground service definitions in AndroidManifest.xml, updating iOS Info.plist with location usage descriptions, and configuring the AppDelegate plugin registrant callback.
await NativeGeofenceManager.instance.initialize();
final zone1 = Geofence(
id: 'zone1',
location: Location(latitude: 40.75798, longitude: -73.98554),
radiusMeters: 500,
triggers: {GeofenceEvent.enter, GeofenceEvent.exit},
);
@pragma('vm:entry-point')
Future<void> geofenceTriggered(GeofenceCallbackParams params) async {
debugPrint('Geofence triggered: $params');
}
await NativeGeofenceManager.instance.createGeofence(zone1, geofenceTriggered);Alternatives
Packages that do the same job and could replace native_geofence.
- flutter_background_geolocation
Background location tracking and geofencing for iOS and Android
89Compare - tracelet
Production-grade background geolocation and tracking plugin for Flutter.
85Compare
Works with
Packages commonly used together with native_geofence: ones it builds on, ones built on it, and its own family.