startNavigation

abstract suspend fun startNavigation(origin: Coordinate? = null, destination: Coordinate, travelMode: TravelMode = TravelMode.Walk(), options: NavigationOptions = NavigationOptions(), searchRules: ItinerarySearchRules = ItinerarySearchRules(), timeout: Duration = 30.seconds): 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).

timeout

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

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): 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.

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()): 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.

Throws

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