WaypointArrivalListener
Used to inform the caller that the WaypointState has been changed during navigation.
The WaypointState changes are detected by the ArrivalDetectionEngine. When notified, the listener can indicate two different states of waypoint arrival experience:
onWaypointArrived which informs that the ArrivalDetectionEngine detected an arrival at a waypoint.
onWaypointDeparted which informs that the ArrivalDetectionEngine detected a departure from a waypoint.
In order to listen to the WaypointState changes, implement this interface to create a listener, for instance:
val waypointArrivalListener = object : WaypointArrivalListener {
override fun onWaypointArrived(waypoint: RouteStop, route: Route) {
// Implement the necessary functionality for handling the waypoint arrival detection
}
override fun onWaypointDeparted(waypoint: RouteStop, route: Route) {
// Implement the necessary functionality for handling the waypoint departure detection
}
}
Subsequently, add this listener using TomTomNavigation.addWaypointArrivalListener. To stop listening to the WaypointState changes, remove the listener using TomTomNavigation.removeWaypointArrivalListener.