THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Follow the chevron

Allow your users to follow their changing positions on the map e.g., when driving. When a new location is set, the animation moves the chevron to the new position.

Sample use case 1: You want to show your user position when driving.

Custom chevron indicator

You can set a custom icon for the chevron indicator.

To create a custom chevron:

ChevronBuilder chevronBuilder = ChevronBuilder.create(activeIcon, inactiveIcon)
chevron = tomtomMap.getDrivingSettings().addChevron(chevronBuilder);
val chevronBuilder = ChevronBuilder.create(activeIcon, inactiveIcon)
chevron = tomtomMap.drivingSettings.addChevron(chevronBuilder)

Chevron tracking mode

Additionally, it is possible to track the chevron. This means that the camera/map and the chevron move when a new location is received so that the map is always centered on the chevron with the bearing of the drive. In the tracking mode, rotate and pan gestures are blocked. The user can only change the zoom level, while the map camera is automatically adjusted to follow the chevron.

To start tracking a selected chevron:

tomtomMap.getDrivingSettings().startTracking(getChevron());
tomtomMap.drivingSettings.startTracking(chevron)

To stop tracking a selected chevron:

tomtomMap.getDrivingSettings().stopTracking();
tomtomMap.drivingSettings.stopTracking()

You can set the chevron position on the map when in tracking mode.

To change the position:

tomtomMap.drivingSettings.setChevronScreenPosition(ChevronScreenPosition(0.5, 0.75))

To reset/center the position of a chevron:

tomtomMap.drivingSettings.centerChevronScreenPosition()

Update chevron location

To update the chevron base on a GPS position, you need to register to location updates. You can register LocationUpdateListener on the TomTomMap instance. After receiving the new location, you can update the position of the chevron. Use this code snippet:

1val listener = LocationUpdateListener { location ->
2 chevron.position = ChevronPosition.Builder(location).build()
3 chevron.show()
4}
5tomtomMap.addLocationUpdateListener(listener)

Remember to unregister the listener:

tomtomMap.removeLocationUpdateListener(listener)

image

Chevron overview

image

Chevron tracking