resume
Restores the navigation session with a given NavigationResumeSnapshot.
Important: This is a Public Preview API. It may be changed or removed at any time.
To retrieve and save the NavigationResumeSnapshot for the ongoing navigation session, see TomTomNavigation.navigationResumeSnapshot.
To resume a previously saved navigation session, you can use the following snippet:
val fileName = "navigation_snapshot"
val file = File(context.filesDir, fileName)
if (file.exists()) {
NavigationResumeSnapshot.deserializeFromFile(file) //Or NavigationResumeSnapshot.deserializeFromBytes(bytes)
.ifSuccess { snapshot ->
tomTomNavigation.resume(navigationResumeSnapshot = snapshot)
}
.ifFailure { failure: NavigationResumeSnapshotSerializationFailure ->
println("An error occurred: $failure")
}
}
As a result of successful action, the following listeners are notified:
NavigationStateChangedListener, with the state set to NavigationState.ActiveGuidance.
RouteAddedListener, with the Route and RoutePlanningOptions set in navigationResumeSnapshot and RouteAddedReason.NavigationResumed.
ActiveRouteChangedListener, with the Route set in navigationResumeSnapshot.
Parameters
The data necessary to resume the navigation session.
Throws
if the navigation session has already started.