Location tracking


Navigation SDK for Android is only available upon request. Contact us to get started.

A good navigation experience requires reliable and frequent location updates.

More details about the TomTom Location module are in the: Location module quickstart document.

Providing a location provider

The LocationProvider used for navigation is initially specified using the Configuration object. However, you can retrieve and change the LocationProvider responsible for location updates at any time.

If the LocationProvider is only used by the navigation, you have to close its instance after updating the TomTomNavigation.

To access the current LocationProvider use:

val currentLocationProvider = tomTomNavigation.locationProvider

To change the LocationProvider use:

1val oldLocationProvider = tomTomNavigation.locationProvider
2tomTomNavigation.locationProvider = locationProvider

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 */

To remove a previously-added listener, call 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:


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

val mapMatchedLocationProvider = MapMatchedLocationProvider(navigation = tomTomNavigation)

Predicted locations

Location updates from location services can lag behind the current situation on the road. Updating the current position with such locations leads to a bad user experience during navigation.

Locations that come from predictions are generated more frequently and often provide a closer approximation of the user’s location.

To reduce this lag effect, TomTomNavigation generates location predictions from the provided locations.

Location predictions are part of the MapMatchingResult provided by the LocationMapMatchedListener. See Map-matched locations section for more information on LocationMapMatchedListener.

Location predictions can also be observed using MapMatchedLocationProvider.

Predictions are enabled by default in MapMatchedLocationProvider.

To turn off predictions use:

1val mapMatchedLocationProviderWithoutPrediction = MapMatchedLocationProvider(
2 navigation = tomTomNavigation,
3 usePredictions = false

Next steps

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