startNavigation

abstract suspend fun startNavigation(origin: Coordinate? = null, destination: Coordinate, travelMode: TravelMode = TravelMode.Walk(), options: NavigationOptions = NavigationOptions(), searchRules: ItinerarySearchRules = ItinerarySearchRules(), itineraryOptions: ItineraryOptions? = null, timeout: Duration = 30.seconds, cameraMode: Int? = CameraMode.TRACKING_COMPASS): Navigation

Starts navigation from an optional origin to the given destination by fetching the best itinerary.

Return

the started Navigation.

Parameters

origin

the starting coordinate. If null, the user's current location is used. Default is null.

destination

the target coordinate to navigate to.

travelMode

the mode of travel (e.g. walk). Defaults to TravelMode.Walk.

options

configuration for navigation behavior such as recalculation interval and arrival threshold.

searchRules

rules applied when searching for an itinerary (e.g. accessibility constraints).

itineraryOptions

visual rendering options for the itinerary line. Pass null to use the current renderer settings.

timeout

the maximum time allowed for the itinerary search request. Defaults to 30 seconds.

cameraMode

the CameraMode to be applied when navigation is started. Default it CameraMode.TRACKING_COMPASS. Pass null to use the current cameraMode. It is not restored when navigation ends — see the discussion on MapNavigationManager.

Throws

if navigation cannot be started — for example, another navigation is already active, or (when origin is null) the user's location cannot be retrieved.

if the itinerary search request fails, for example a network error or no itinerary found.


abstract suspend fun startNavigation(navigation: Navigation, itineraryOptions: ItineraryOptions? = null, cameraMode: Int? = CameraMode.TRACKING_COMPASS): Navigation

Starts navigation using a previously obtained Navigation object.

Use this overload to resume or replay a navigation that was already fetched, without triggering a new itinerary search.

Return

the started Navigation.

Parameters

navigation

the Navigation object to start.

itineraryOptions

visual rendering options for the itinerary line. Pass null to use the current renderer settings.

cameraMode

the CameraMode to be applied when navigation is started. Default it CameraMode.TRACKING_COMPASS. Pass null to use the current cameraMode. It is not restored when navigation ends — see the discussion on MapNavigationManager.

Throws

if navigation cannot be started, for example another navigation is already active.


abstract suspend fun startNavigation(itinerary: Itinerary, options: NavigationOptions = NavigationOptions(), searchRules: ItinerarySearchRules = ItinerarySearchRules(), itineraryOptions: ItineraryOptions? = null, cameraMode: Int? = CameraMode.TRACKING_COMPASS): Navigation

Starts navigation along a specific itinerary without performing a new itinerary search.

Use this overload when you already have an Itinerary object and want to navigate along it directly.

Return

the started Navigation.

Parameters

itinerary

the Itinerary to navigate along.

options

configuration for navigation behavior such as recalculation interval and arrival threshold.

searchRules

rules applied if navigation recalculation is triggered.

itineraryOptions

visual rendering options for the itinerary line. Pass null to use the current renderer settings.

cameraMode

the CameraMode to be applied when navigation is started. Default it CameraMode.TRACKING_COMPASS. Pass null to use the current cameraMode. It is not restored when navigation ends — see the discussion on MapNavigationManager.

Throws

if navigation cannot be started, for example another navigation is already active.