fun setNavigationRoutes(    routes: List<NavigationRoute>,     initialLegIndex: Int = 0,     callback: RoutesSetCallback? = null)

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.

This call is asynchronous, only once callback returns the effects are available through MapboxNavigation.getNavigationRoutes and RoutesObserver. If this call fails, no changes are made to the routes managed by the MapboxNavigation, they are not cleared.

See also



a list of NavigationRoutes


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


callback to be called when routes are set or ignored due to an error. See RoutesSetCallback.