mapbox / mapbox-maps-flutter

Interactive, thoroughly customizable maps for Flutter powered by Mapbox Maps SDK
https://www.mapbox.com/mobile-maps-sdk
Other
245 stars 93 forks source link

How to get puck location update timestamp? #507

Open kooinam-ridebeam opened 3 weeks ago

kooinam-ridebeam commented 3 weeks ago

We are using the following scripts to get current user location from mapbox

  Future<GeoLocator.Position?> getPuckPosition() async {
    Layer? layer;
    if (Platform.isAndroid) {
      layer = await getLayer("mapbox-location-indicator-layer");
    } else {
      layer = await getLayer("puck");
    }

    if (layer == null) {
      return null;
    }
    final location = (layer as LocationIndicatorLayer).location;
    if (location == null) {
      return null;
    }

    final accuracy = (layer as LocationIndicatorLayer).accuracyRadius;

    return Future.value(GeoLocator.Position(
      latitude: location[0]!,
      longitude: location[1]!,
      timestamp: DateTime.now(),
      accuracy: accuracy ?? 0,
      altitude: 0,
      heading: 0,
      speed: 0,
      speedAccuracy: 0,
    ));
  }
}

It works as expected, however i would like to get when is the location updated within mapbox. Is it possible to get this info for mapbox?