mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

How to get puck location update timestamp?

Open kooinam-ridebeam opened this issue 1 year ago • 0 comments

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?

kooinam-ridebeam avatar Apr 23 '24 07:04 kooinam-ridebeam