onResume method

  1. @override
Future<bool> onResume()
override

Callback when this executor is resumed. Returns true if successfully resumed, false otherwise.

Implementation

@override
Future<bool> onResume() async {
  // start the location data stream from the LocationManager
  Stream<LocationSample> locationStream = LocationManager()
      .onLocationChanged
      .map((loc) => LocationSample(
          GeoLocation(loc.latitude!, loc.longitude!), DateTime.now()));

  // feed the location data stream to the MobilityFeatures singleton
  // which in turn produce [MobilityContext]s
  await MobilityFeatures().startListening(locationStream);

  return super.onResume();
}