HorizonUpdatedListener
interface HorizonUpdatedListener
Interface to horizon update listeners. Used to receive horizon update events during navigation.
To listen to horizon updates while navigating, first implement this interface to create a listener, for example:
val horizonUpdatedListener = object : HorizonUpdatedListener {
override fun onSnapshotUpdated(options: HorizonOptions, snapshot: HorizonSnapshot) {
// add code here that handles the horizon snapshot update
}
override fun onPositionUpdated(options: HorizonOptions, position: HorizonPosition) {
// add code here that handles the horizon position update
}
}
Content copied to clipboard
Then, add the listener you created with the TomTomNavigation object for the set of horizon options for which you wish to receive an update. To do that, use addHorizonUpdatedListener:
tomTomNavigation.addHorizonUpdatedListener(horizonOptions, horizonUpdatedListener)
Content copied to clipboard
To stop listening to horizon updates, remove the listener using removeHorizonUpdatedListener:
tomTomNavigation.removeHorizonUpdatedListener(horizonUpdatedListener)
Content copied to clipboard