mapbox / mapbox-maps-flutter

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

LocationPuck2D not showing on Android Devices #160

Open samstamper33 opened 1 year ago

samstamper33 commented 1 year ago

I am not able to show the 2D location puck on an android device. Also, puck bearing and pulse are not showing on Apple devices. Here is what I'm using:

_onMapCreated(MapboxMap mapboxMap) { mapboxMap.compass.updateSettings(settings); mapboxMap.setBounds(widget.cameraOptions()); mapboxMap.scaleBar.updateSettings(scaleSettings); mapboxMap.attribution.updateSettings(attributionSettings); this.mapboxMap = mapboxMap; mapboxMap.location.updateSettings(LocationComponentSettings( showAccuracyRing: true, puckBearingEnabled: true, pulsingEnabled: true, locationPuck: LocationPuck(locationPuck2D: LocationPuck2D()))); }

I also have the following in my android manifest:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

securexperts commented 1 year ago

Same for me!

securexperts commented 1 year ago

Hi, I found a temporary solution by reloading the Style of the Map after you created your Puck. You can do this by creating in the map event _onStyleDataLoadedListener:

  bool refreshAnnotationsOnce = true;
  _onStyleDataLoadedListener(StyleDataLoadedEventData data) {
    if (kDebugMode) {
      print("MapBoxEvent: StyleDataLoadedEventData: begin: ${data.begin}, end: ${data.end}");
      //Suppress code when 2DPuck loading is fixed
      if (refreshAnnotationsOnce) {
        mapboxMap.loadStyleURI(fourUmApp.mapboxMapStyleSatelliteStreet);
        refreshAnnotationsOnce = false;
      }
    }
  }

Nice day

Roman

samstamper33 commented 1 year ago

I'm not having too much luck reloading the style. I show the accuracy ring and bearing, but don't show the puck.

ilyosbekkk commented 1 year ago

any updates on this issue?