RouteAddedListener
Informs the caller that a route has been added to the navigation session.
A new route can be added to the session under the following circumstances:
When navigation has started with a route using the TomTomNavigation.start method with NavigationOptions argument.
When the active route plan is updated using the TomTomNavigation.setActiveRoutePlan method. Note that if the new route is identical which means it has the same Route.id as the currently active route, it will not trigger the listener.
When navigation finds a better route, and the TomTomNavigation.betterProposalAcceptanceMode is set to either BetterProposalAcceptanceMode.Manual or BetterProposalAcceptanceMode.UnreachableOnly.
When navigation finds a reachable route and TomTomNavigation.betterProposalAcceptanceMode is configured to BetterProposalAcceptanceMode.Manual
When navigation finds a reachable route, due to navigated route being unreachable, and TomTomNavigation.betterProposalAcceptanceMode is set to BetterProposalAcceptanceMode.UnreachableOnly and the reachable route is automatically applied.
When the TomTomNavigation.betterProposalAcceptanceMode is set to BetterProposalAcceptanceMode.Automatic and the proposed route is automatically applied.
When navigation automatically replans and adds the newly planned route to the session.
When the TomTomNavigation.preferredLanguage is set and the replanning with the new language is completed.
To listen to the route being added to the session, first implement this interface to create a listener, for example:
val routeAddedListener = RouteAddedListener { route, options, reason ->
// add code here that handles the route being added to the session
}
Then add this listener using TomTomNavigation.addRouteAddedListener. To stop listening to the route being added to the session, remove the listener using TomTomNavigation.removeRouteAddedListener.
Please note that RouteAddedListener is triggered only when the replanned route differs from the current active route in terms of geometry. Events like route refresh and increment update of guidance instructions will not trigger this listener. For these scenarios the RouteUpdatedListener is called.
The complementary listener that provides updates on the removal of routes from the session is RouteRemovedListener. IMPORTANT: The addition of a route to the session does not necessarily make it active. To listen to the active route changes, use the ActiveRouteChangedListener.