CodeName OneShai Almog4 min readintermediate
A Polyline Is Not a Route
Summary
Codename One adds a portable routing API (com.codename1.maps.routing) that separates route discovery from map rendering, offering a simple two‑line `showRoute` helper and a full callback‑based flow for custom UI, multiple alternatives, waypoints, and encoded polylines. The default service uses OSRM (no API key), but the design lets you plug any provider or self‑hosted engine via a `RouteService`…
- Routing is now a first‑class, provider‑agnostic model in Codename One, distinct from the map surface.
- Two convenience levels: `Routing.showRoute` for quick display, and `Routing.findRoute` with a `RouteCallback` for full control (styling, ETA, alternatives).
- Default `OsrmRouteService` works out‑of‑the‑box (no API key) but is not production‑grade; self‑hosted OSRM or custom `RouteService` implementations are encouraged for reliability and custom constraints.
- The model exposes distance (meters), duration (seconds), bounds, legs, steps, and encoded polylines (precision 5/6).
Provides a clean abstraction for road routing across mobile platforms, enabling developers to integrate reliable navigation data without coupling to a specific map renderer or provider. This reduces boilerplate, improves testability, and opens the path for custom routing constraints (e.g., truck he…
6/10

