ActiveRouteChangedListener
Used to inform the caller that the active route has been changed. The active route is the only route that is being followed for which the navigation provides guidance.
The active route is changed when:
The navigation is started with a new route using the TomTomNavigation.start method with NavigationOptions argument.
The navigation is resumed using the TomTomNavigation.resume method.
The active route plan is updated using the TomTomNavigation.setActiveRoutePlan method. Note: if TomTomNavigation.setActiveRoutePlan is called on the currently active route, this listener will not receive an active route changed notification.
A replanning is completed by the navigation and a new route is set as the active route. Replanning can be triggered by: -- Deviating from the active route. -- Running out of battery, in the case of EV navigation. -- Requesting a navigation language change, by using the TomTomNavigation.preferredLanguage property. -- Continuous replanning: --- A better route is found and accepted automatically. --- A better route is found and accepted manually using the TomTomNavigation.selectActiveRoute method. --- A better route is found and accepted by steering onto it.
In order to listen to the active route changes, implement this interface to create a listener, for instance:
val activeRouteChangedListener = ActiveRouteChangedListener { route ->
// Implement the necessary functionality for handling the active route being changed
}
Subsequently, add this listener using TomTomNavigation.addActiveRouteChangedListener. To stop listening to the active route changes, remove the listener using TomTomNavigation.removeActiveRouteChangedListener.
The ActiveRouteChangedListener is called post the addition of the new route to the navigation and prior to the removal of the old active route. Hence, it is called after the RouteAddedListener and before the RouteRemovedListener.