Map-matched location provider

VERSION 0.48.0
PUBLIC PREVIEW

Map-matched locations

Locations provided by a location service have an element of inaccuracy. Using the raw location to update the current user’s position can lead to a position indicator that is unaligned with the Route. To solve this inaccuracy problem, TomTomNavigation produces map-matched locations based on raw locations from the provided LocationProvider. Matched locations are observed through the LocationMapMatchedListener.

1val locationMapMatchedListener = LocationMapMatchedListener { mapMatchingResult: MapMatchingResult ->
2 /* Your code goes here */
3}
4tomTomNavigation.addLocationMapMatchedListener(locationMapMatchedListener)

To remove a previously-added listener, call TomTomNavigation.removeLocationMapMatchedListener(LocationMapMatchedListener).

tomTomNavigation.removeLocationMapMatchedListener(locationMapMatchedListener)

To make it easier to provide a map-matched location into the TomTomMap, the Navigation module provides the MapMatchedLocationProvider. It is a special implementation of a LocationProvider that accepts TomTomNavigation.

Before using the MapMatchedLocationProvider, add the module dependency in the build.gradle.kts of your application module and synchronize the project:

implementation("com.tomtom.sdk.location:provider-map-matched:0.48.0")

Then you can create MapMatchedLocationProvider and use it in the TomTomMap.

val mapMatchedLocationProvider = MapMatchedLocationProvider(navigation = tomTomNavigation)
tomTomMap.setLocationProvider(mapMatchedLocationProvider)

Next steps

Since you have learned about location tracking, here are recommendations for the next steps: