buildRoutePlanningOptions

fun buildRoutePlanningOptions(itinerary: Itinerary, @IntRange(from = 0, to = 2) maxAlternatives: Int = 0, routeType: RouteType = RouteType.Fast, avoids: Set<AvoidType> = emptySet(), language: Locale = Locale.ENGLISH, instructionPhoneticsType: InstructionPhoneticsType = InstructionPhoneticsType.Ipa): RoutePlanningOptions

Deprecated

This will be removed from future releases after 2027-04-19. Use com.tomtom.sdk.routing.options.buildRoutePlanningOptions with the builder lambda instead. Move each explicit parameter into the trailing lambda.

Replace with

import com.tomtom.sdk.routing.options.buildRoutePlanningOptions
buildRoutePlanningOptions(itinerary) { }

Creates options for planning routes which are passed to one of the various route planners.

Prefer the builder-style com.tomtom.sdk.routing.options.buildRoutePlanningOptions, which configures the options through a RoutePlanningOptions.Builder lambda. To migrate, change the import to the com.tomtom.sdk.routing.options package and move each explicit parameter into the trailing lambda, for example:

val options = buildRoutePlanningOptions(itinerary = itinerary) {
maxAlternatives = 2
routeType = RouteType.Fast
}

Parameters

itinerary

The list of route locations.

maxAlternatives

Maximum number of desired alternative routes. Value must be in range: 0,2.

routeType

General strategy for selecting roads during route calculation.

avoids

What kind of roads should be be avoided while calculating a route.

language

The locale of guidance instruction and road name sections. Default value is Locale.ENGLISH.

instructionPhoneticsType

The phonetics type of the guidance instructions. Default value is InstructionPhoneticsType.Ipa.

Throws

when:

  • maxAlternatives is set to a value outside 0, 2.

  • VehicleProvider.vehicle is not set to Vehicle.Car.