startGeofences static method
Engages the geofences-only State.trackingMode.
In this mode, no active location-tracking will occur -- only geofences will be monitored. To stop monitoring "geofences" trackingMode
, simply use the usual stop method.
Example
// Add a geofence.
BackgroundGeolocation.addGeofence(Geofence(
notifyOnExit: true,
radius: 200,
identifier: 'ZONE_OF_INTEREST',
latitude: 37.234232,
longitude: 42.234234
));
// Listen to geofence events.
BackgroundGeolocation.onGeofence((GeofenceEvent event) {
print('[onGeofence] - ${event}')
});
BackgroundGeolocation.ready(Config(
url: 'http://my.server.com',
autoSync: true
)).then((State state) {
BackgroundGeolocation.startGeofences();
});
Implementation
static Future<State> startGeofences() async {
Map state = (await _methodChannel.invokeMapMethod('startGeofences'))!;
return State(state);
}