GuidanceUpdatedListener
Used to inform the caller that the guidance information has been updated. This interface provides listeners when there are changes in instructions, announcements, and distance to next instruction.
The method GuidanceEngine.generateGuidance generates the guidance with instructions and distance. The methods of the listener are triggered based on the guidance results.
The GuidanceUpdatedListener interface provides the methods for handling several events like instruction changes, announcement generation, and distance changes to the next instruction. These methods facilitate efficient and dynamic update of guidance information during a journey.
In order to listen to the guidance updates, implement this interface to create a listener, for instance:
val guidanceUpdatedListener = GuidanceUpdatedListener {
override fun onInstructionsChanged(instructions: List<GuidanceInstruction>) {
// Implement the necessary functionality for handling the instructions changes
}
override fun onAnnouncementGenerated(announcement: GuidanceAnnouncement, shouldPlay: Boolean) {
// Implement the necessary functionality for handling the announcement generation
}
override fun onDistanceToNextInstructionChanged(
distance: Distance,
instructions: List<GuidanceInstruction>,
currentPhase: InstructionPhase
) {
// Implement the necessary functionality for handling the change in distance to the next instruction
}
}
Subsequently, add this listener using TomTomNavigation.addGuidanceUpdatedListener. To stop listening to the guidance updates, remove the listener using TomTomNavigation.removeGuidanceUpdatedListener.
Functions
Called whenever the upcoming maneuver announcement has been generated.
Called whenever the distance to the next instruction has been updated.
Called whenever the next instructions have been changed.