Location context

VERSION 0.3.1056
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 LocationProvider 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 - This is the current speed in meters per second, or null if it is unknown.
  • speedLimit - This is the speed limit in meters per second.
  • streetName - This is the street name.
  • city - The city.
  • country - The country.
  • countryCode - This is the three-character ISO 3166-1 alpha-3 country code.
  • isTunnel - This indicates whether the location is in a tunnel.
  • isUnderpass - This indicates whether the location is on an underpass.
  • functionalRoadClass - This indicates the relative importance of the road within 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)

Next steps

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