GuidanceUpdatedListener

Informs the caller about updates in the guidance information. 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.

To listen to the guidance updates, first implement this interface to create a listener, for example:

val guidanceUpdatedListener = object : GuidanceUpdatedListener {
override fun onInstructionsChanged(instructions: List<GuidanceInstruction>) {
// Add code here that handles the changes in instructions.
}
override fun onAnnouncementGenerated(announcement: GuidanceAnnouncement, shouldPlay: Boolean) {
// Add code here that handles the announcement generation.
}
override fun onDistanceToNextInstructionChanged(
distance: Distance,
instructions: List<GuidanceInstruction>,
currentPhase: InstructionPhase
) {
// Add code here that handles the change in distance to the next instruction.
}
}

Then add this listener using TomTomNavigation.addGuidanceUpdatedListener.

To stop listening to the guidance updates, remove the listener using TomTomNavigation.removeGuidanceUpdatedListener.

Functions

Link copied to clipboard
abstract fun onAnnouncementGenerated(announcement: GuidanceAnnouncement, shouldPlay: Boolean)

Called when an announcement about the upcoming maneuver is generated.

Link copied to clipboard
abstract fun onDistanceToNextInstructionChanged(distance: Distance, instructions: List<GuidanceInstruction>, currentPhase: InstructionPhase)

Called with each location update that changes the distance to the instruction.

Link copied to clipboard
abstract fun onInstructionsChanged(instructions: List<GuidanceInstruction>)

Called when the next instructions change.