1

I am using the version of mapbox-android-sdk and mapbox-android-plugin-locationlayer

// Mapbox
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.6.1'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.11.0'

One problem I am facing is, once I enable user tracking by setting cameraMode to TRACKING like below:

mapboxMap.locationComponent.cameraMode = CameraMode.TRACKING

When I zoom in/out into the map the zoomed location changes from the user tracked position to the pinched/zoomed location of the screen.

Any idea on how to zoom in/out and keep the tracked user location centered and tracking enabled?

Mehdi Karamosly
  • 5,388
  • 2
  • 32
  • 50

1 Answers1

1

When you activate your location component, you can add LocationComponentOptions with trackingGesturesManagement enabled

val options = LocationComponentOptions.builder(context)
    .trackingGesturesManagement(true)
    .build()
mapboxMap?.locationComponent?.activateLocationComponent(context!!, options)

https://www.mapbox.com/android-docs/api/map-sdk/6.6.0/com/mapbox/mapboxsdk/location/LocationComponentOptions.html#trackingGesturesManagement--

John Oberhauser
  • 396
  • 1
  • 3
  • 12