requestRoutes

fun requestRoutes(routeOptions: RouteOptions, routesRequestCallback: RouterCallback): Long

Requests a route using the available Router implementation.

Use MapboxNavigation.setRoutes to supply the returned list of routes, transformed list, or a list from an external source, to be managed by the SDK.

Example:

mapboxNavigation.requestRoutes(routeOptions, object : RouterCallback {
override fun onRoutesReady(routes: List<DirectionsRoute>) {
...
mapboxNavigation.setRoutes(routes)
}
...
})

Return

requestId, see cancelRouteRequest

See also

Parameters

routeOptions

params for the route request. Make sure to use the applyDefaultNavigationOptions for the best navigation experience (and to set required request parameters). You can also use applyLanguageAndVoiceUnitOptions get instructions' language and voice unit based on the device's Locale. It's also worth exploring other available options (like enabling alternative routes, specifying destination approach type, defining waypoint types, etc.)

routesRequestCallback

listener that gets notified when request state changes


fun requestRoutes(routeOptions: RouteOptions, callback: NavigationRouterCallback): Long

Requests a route using the available NavigationRouter implementation.

Use MapboxNavigation.setNavigationRoutes to supply the returned list of routes, transformed list, or a list from an external source, to be managed by the SDK.

Example:

mapboxNavigation.requestRoutes(routeOptions, object : NavigationRouterCallback {
override fun onRoutesReady(routes: List<NavigationRoute>) {
...
mapboxNavigation.setNavigationRoutes(routes)
}
...
})

Return

requestId, see cancelRouteRequest

See also

Parameters

routeOptions

params for the route request. Make sure to use the applyDefaultNavigationOptions for the best navigation experience (and to set required request parameters). You can also use applyLanguageAndVoiceUnitOptions get instructions' language and voice unit based on the device's Locale. It's also worth exploring other available options (like enabling alternative routes, specifying destination approach type, defining waypoint types, etc.)

callback

listener that gets notified when request state changes