onGeofence static method
Subscribe to Geofence transition events.
Your supplied callback
will be called when any monitored geofence crossing occurs.
Example
BackgroundGeolocation.onGeofence((GeofenceEvent event) { print('onGeofence ${event}'); });
Implementation
static void onGeofence(Function(GeofenceEvent) callback) {
if (_eventsGeofence == null) {
_eventsGeofence = _eventChannelGeofence
.receiveBroadcastStream()
.map((dynamic event) => GeofenceEvent(event));
}
_registerSubscription(_eventsGeofence!.listen(callback), callback);
}