RouteUpdatedListener2

fun interface RouteUpdatedListener2

Used to inform the caller that a route has been updated.

The current route is updated under the following circumstances:

  • When the route data is refreshed with data from the replanned route.

  • When instructions and lane guidance are incrementally updated for the current route.

  • When the route data refresh has failed and on of the following conditions are met:

    • The conditions on current route has changed and expected time of arrival (ETA) has changed significantly.

    • There is a better route available that is much faster than the refreshed route.

    • The current route was last successfully updated long time ago.

    • There is a blockage or the route stop is out of range.

In order to listen to the route updates, implement this interface to create a listener, for instance:

val routeUpdatedListener = RouteUpdatedListener2 { route, reason ->
// Implement the necessary functionality for handling the updated route
}

Subsequently, add this listener using TomTomNavigation.addRouteUpdatedListener2. To stop listening to the route updates, remove the listener using TomTomNavigation.removeRouteUpdatedListener2.

Note: The RouteUpdatedListener2 does not guarantee that the route geometry will be preserved. The new route may be provided starting from the current position. This means the previously traveled part will be discarded, route progress will be reset, and the route will need to be redrawn.

When RouteUpdatedListener2 is called, the active route does not change, and therefore the ActiveRouteChangedListener is not invoked.

To listen for replanning events that result in geometry changes, such as replanning after deviations, use the RouteAddedListener, RouteRemovedListener, and ActiveRouteChangedListener.

Note: If both RouteUpdatedListener and RouteUpdatedListener2 are registered and a route data refresh fails, the new route will not be provided.

Functions

Link copied to clipboard
abstract fun onRouteUpdated(route: Route, reason: RouteUpdatedReason)

Called whenever a Route has been successfully updated.