ReplayHistorySession

class ReplayHistorySession : MapboxNavigationObserver

Testing and previewing the navigation experience is an important part of building with the Navigation SDK. You can use the SDK's replay functionality to go back in time and replay real experiences.

The ReplayHistorySession will push the history events into the MapboxReplayer. Some customizations can found in the ReplayHistorySessionOptions. In order to record history files refer to the MapboxHistoryRecorder.

Typically you would save a history file to a registry, and then select history files to replay in order to improve or demo an experience. But for the sake of example, this is how you would replay an experience that just happened.

mapboxNavigation.historyRecorder.stopRecording { historyFile ->
historyFile?.let {
replayHistorySession.setHistoryFile(historyFile)
replayHistorySession.onAttached(mapboxNavigation)
}
}

Constructors

Link copied to clipboard
fun ReplayHistorySession()

Functions

Link copied to clipboard
fun getOptions(): StateFlow<ReplayHistorySessionOptions>

Allows you to get or observe the ReplayHistorySessionOptions.

Link copied to clipboard
open override fun onAttached(mapboxNavigation: MapboxNavigation)

Signals that the mapboxNavigation instance is ready for use.

Link copied to clipboard
open override fun onDetached(mapboxNavigation: MapboxNavigation)

Signals that the mapboxNavigation instance is being detached.

Link copied to clipboard
fun setHistoryFile(absolutePath: String)

Change the history file to replay, if changed after onAttached, the previous trip will be reset and the new file will start.

Link copied to clipboard
fun setOptions(options: ReplayHistorySessionOptions)