onResume method
Callback when this executor is resumed. Returns true if successfully resumed, false otherwise.
Implementation
@override
Future<bool> onResume() async {
CircularGeofence fence = CircularGeofence.fromGeofenceSamplingConfiguration(
samplingConfiguration as GeofenceSamplingConfiguration,
);
// listen in on the location service
deviceManager.manager.onLocationChanged
.map((location) => GeoPosition.fromLocation(location))
.listen((location) {
// when a location event is fired, check if the new location creates a new [GeofenceData] event.
// if so -- add it to the main stream.
Geofence? data = fence.moved(location);
if (data != null) {
geoFenceStreamController.add(Measurement.fromData(data));
}
});
return await super.onResume();
}