SCTaylor
SCTaylor

Reputation: 141

Mapbox disabled user location tracking on camera pan

I have recently been trying to find a way to allow users to go from being locked into MyLocationTracking.TRACKING_FOLLOW to MyLocationTracking.TRACKING_NONE if they try to pan the camera.

In essence I am hoping to implement functionality similar to Google Maps "Free roam" and "Recenter" features. However I have had a bit of trouble detecting when the user is attempting to pan the camera when in TRACKING_FOLLOW mode.

I have tried using mapboxMap.getTrackingSettings().setDismissLocationTrackingOnGesture(true); however it seems that using this the location tracking is disabled as soon as I set the location tracking to TRACKING_FOLLOW - without any user input (Perhaps the auto-rotation from using TRACKING_FOLLOW is triggering gestures). I also assume that this disables location tracking on all gestures zoom, rotation, panning, etc - rather than just when the user starts panning the camera.

I am sure that I am missing something very obvious but I was wondering if anyone who has an idea on how to achieve this functionality could point me in the right direction. Thanks!

Upvotes: 1

Views: 545

Answers (1)

cammace
cammace

Reputation: 3168

If you want to determine if the user is in TRACKING_FOLLOW mode or not, you can run a check inside an onMapScroll listener and if they aren't in tracking then display your "recenter" button. Does this answer your question or am I not understanding the issue correctly?

Upvotes: 1

Related Questions