Platform:Android
Mapbox SDK version:Release Android v5.1.0-beta.3
I'm working on a sample of navigation mode (like your CarDrivingActivity in last version).
The code below activate the tracking and set GPS bearing mode.
trackingSettings.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
trackingSettings.setMyBearingTrackingMode(MyBearingTracking.GPS);
I replace the default drawable icon in MyLocationViewSettings by a custom drawable. This let me know the orientation of user position.
Without disabling all gesture, when the user pan the map, the tracking mode is NONE and the user position bearing should take real myLocation bearing value.
The pan on the map disable the tracking and myLocationView ignore bearing value (I think it equals to 0).
@13kz you can fine tune this behaviour with a couple of flags in trackingsettings. eg. you don't want to dismiss tracking at all when a gesture occuirs:
TrackingSettings#setDismissAllTrackingOnGesture(false)
You can also do this more granular:
TrackingSettings#setDismissLocationTrackingOnGesture
or
TrackingSettings#setDismissBearingTrackingOnGesture
If this doesn't fit your use-case completely you can hook into these dismissal events with:
TrackingSettings#setOnMyLocationTrackingModeChangeListener
or
TrackingSettings#setOnMyBearingTrackingModeChangeListener
Let us know if you have any more questions or if you aren't able to use above to handle your use-case.
Closing for now as answered.
Thanks @tobrun for your answer. I try to avoid dismissing bearing tracking on gesture when i'm in navigation mode and it's solve my problem.
TrackingSettings#setDismissBearingTrackingOnGesture(false)
Update : setDismissBearingTrackingOnGesture instead of AllTrackingGesture
@tobrun @13kz I stumbled on this same issue. However, even if TrackingSettings#setDismissBearingTrackingOnGesture is set to false when we are in MyLocationTracking#TRACKING_NONE mode (therefore MyLocationShowBehavior is used) bearing is not updated on location change as MyLocationView#setBearing() is never called. I tried invoking MyLocationView#setBearing() from MyLocationView#setLocation() but I doesn't seem to do the trick.
@LukasPaczos Without setting TrackingSettings#setDismissBearingTrackingOnGesture(false), it's seems like the bearing equals to 0. And when you rotate the map the arrow is pointing the top of my device.
@13kz check out #9207. That is what worked for me to update bearing while TRACKING_NONE mode is on.
Hey 馃憢 @13kz
Thanks @LukasPaczos
Yep @Guardiola31337 we are good.
Nice @LukasPaczos
@13kz Thanks a lot 馃槈