Routing
Finds the efficient route between two locations. The result contains polyline geometries which need to be decoded so they can be drawn on the map.
Find a route
val startPoint = LatLng(28.6139, 77.2090)
val endPoint = LatLng(28.6239, 77.2090)
SSMap.findRoute(startPoint, endPoint) { result, error ->
result?.routes?.firstOrNull()?.geometry?.let { geometryString ->
// Decode the polyline and draw on the map
val decodedCoords = SSMap.coordsDecode(geometryString)
val routeLinePoints = decodedCoords.map { Point.fromLngLat(it.longitude, it.latitude) }
drawLine(routeLinePoints)
}
}
// You can also pass a list of coordinates to findRoute for waypoints:
// val listWaypoints = listOf(startPoint, midPoint, endPoint)
// SSMap.findRoute(listWaypoints) { result, error -> ... }

See also: Android Map SDK overview, Draw Shapes.