geofenceModeHighAccuracy property
[Android only]
Enable high-accuracy for geofence-only mode (See BackgroundGeolocation.startGeofences).
Defaults to false
. Runs Android's BackgroundGeolocation.startGeofences with a///foreground service* (along with its corresponding persitent notification; See Notification for a list of available notification config options, including Notification.text, Notification.title).
Configuring geofenceModeHighAccuracy: true
will make Android geofence triggering///far more responsive*. In this mode, the usual config options to control location-services will be applied:
⚠️ Warning: Will consume more power.
- desiredAccuracy (DESIRED_ACCURACY_MEDIUM works well).
- locationUpdateInterval
- distanceFilter
- deferTime
With the default geofenceModeHighAccuracy: false
, a device will have to move farther into a geofence before the ENTER event fires and farther out of a geofence before
the EXIT event fires.
The more aggressive you configure the location-update params above (at the cost of power consumption), the more responsive will be your geofence-triggering.
Example:
BackgroundGeolocation.ready(Config(
geofenceModeHighAccuracy: true,
desiredAccuracy: Config.DESIRED_ACCURACY_MEDIUM,
locationUpdateInterval: 5000,
distanceFilter: 50
)).then((state) {
BackgroundGeolocation.startGeofences();
});
Example geofenceModeHighAccuracy: false
(Default) — Transition events are delayed.
Example geofenceModeHighAccuracy: true
— Transition events are nearly instantaneous.
Implementation
bool? geofenceModeHighAccuracy;