Location context
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:
- speed - This is the current
Speed
, or null if it is unknown. - speedLimit - This is the
SpeedLimit
. - address:
- streetName - The street name.
- city - The city name.
- countryName - The country name.
- countryCode - This is the three-character ISO 3166-1 alpha-3 country code.
- road:
- 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.
- isTunnel - This indicates whether the location is in a tunnel.
- isUnderpass - This indicates whether the location is on an underpass.
- roadType - This is the type of the current road, see
TypeOfRoad
. - isLeftHandDriving - This indicates whether the driving side on the current road is left-handed.
The extracted LocationContext
is sent to LocationContextUpdatedListener
.
1val locationContextUpdatedListener = object : LocationContextUpdatedListener {2 override fun onLocationContextUpdated(locationContext: LocationContext) {3 /* YOUR CODE GOES HERE */4 }5}6tomTomNavigation.addLocationContextUpdatedListener(locationContextUpdatedListener)
To remove a previously-added LocationContextUpdatedListener
, use the TomTomNavigation.removeLocationContextUpdatedListener(LocationContextUpdatedListener)
method.
tomTomNavigation.removeLocationContextUpdatedListener(locationContextUpdatedListener)
Next steps
Since you have learned about location context, here are recommendations for the next steps: