setRoutes

fun setRoutes(routes: List<DirectionsRoute>, initialLegIndex: Int = 0)

Set a list of routes.

If the list is not empty, the route at index 0 is valid, and the trip session is started, then the SDK enters an Active Guidance state and RouteProgress updates will be available.

If the list is empty, the SDK will exit the Active Guidance state.

Use RoutesObserver and MapboxNavigation.registerRoutesObserver to observe whenever the routes list reference managed by the SDK changes, regardless of a source.

See also

Parameters

routes

a list of DirectionsRoutes

initialLegIndex

starting leg to follow. By default the first leg is used.