Optimize Route
Given an unordered list of waypoints, optimizeRoute returns an optimal multi-stop sequence.
Optimize a multi-stop route
val optimalWaypoints = listOf(
startPoint,
midPoint1,
midPoint2,
endPoint
)
SSMap.optimizeRoute(optimalWaypoints) { result, error ->
result?.routes?.firstOrNull()?.geometry?.let { geometryString ->
// Decode the polyline and draw on the map
val decodedCoords = SSMap.coordsDecode(geometryString)
val optimalRoutePoints = decodedCoords.map { Point.fromLngLat(it.longitude, it.latitude) }
drawLine(optimalRoutePoints)
}
}

See also: Android Map SDK overview, Routing.