Location context

VERSION 0.3.34
PUBLIC PREVIEW

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

The detailed information about a current location on the road is called the location context.

Every location update that comes from LocationEngine to TomTomNavigation is map matched. The map matched locations are then used as input for LocationContextProviderEngine, which returns a LocationContext object.

LocationContext consists of:

  • speedInMetersPerSecond - The current speed in meters per second, or null if it is unknown.
  • speedLimit - The speed limit in meters per second.
  • streetName - The street name.
  • city - The city.
  • country - The country.
  • countryCode - The 3-character ISO 3166-1 alpha-3 country code.
  • isTunnel - Indicates if the location is in a tunnel.
  • isUnderpass - Indicates if the location is in an underpass.
  • functionalRoadClass - Indicates relative importance of the road in the routing network. Regular values are in range [0, 7], where lower numbers indicate more important, faster roads.

The extracted LocationContext is sent to OnLocationContextUpdateListener.

1val onLocationContextUpdateListener = object : OnLocationContextUpdateListener {
2 override fun onLocationContextUpdated(locationContext: LocationContext) {
3 /* YOUR CODE GOES HERE */
4 }
5}
6tomTomNavigation.addOnLocationContextUpdateListener(onLocationContextUpdateListener)

To remove a previously-added OnLocationContextUpdateListener, use the TomTomNavigation.removeOnLocationContextUpdateListener(OnLocationContextUpdateListener) method.

tomTomNavigation.removeOnLocationContextUpdateListener(onLocationContextUpdateListener)