THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Documentation

This component integrates the Routing API described on https://developer.tomtom.com/routing-api/documentation/product-information/introduction. The service calculates a route between an origin and a destination, passing through waypoints if they are specified.

The outing API is one of our most advanced APIs, enabling the user to calculate a perfect path from point A to point B.

  • RoutingBuilder is instantiated with the API Key for the TomTom Online Routing service.
  • You can set an origin and a destination, if you want to route from the current location, then simply pass it to the from() method of the RoutingBuilder.
  • You can set a list of via points to lead the way though them.
  • You can provide locations as points, or as approximate points (circles).

To initialise routing:

routingApi = OnlineRoutingApi.create(context, BuildConfig.ROUTING_API_KEY)
private val routingApi = OnlineRoutingApi.create(context, BuildConfig.ROUTING_API_KEY)

To execute routing:

routingApi.planRoute(routeSpecification, routeCallback);
routingApi.planRoute(routeSpecification, routeCallback)

To display a route on the map:

1RouteBuilder routeBuilder = new RouteBuilder(route.getCoordinates())
2 .endIcon(endIcon)
3 .startIcon(startIcon)
4 .style(routeStyle);
5final Route mapRoute = tomtomMap.addRoute(routeBuilder);
1val routeBuilder = RouteBuilder(route.getCoordinates())
2 .style(RouteStyle.DEFAULT_ROUTE_STYLE)
3 .startIcon(createIcon(R.drawable.ic_map_route_departure))
4 .endIcon(createIcon(R.drawable.ic_map_route_destination))
5 .tag(routeIdx.toString())
6tomtomMap.addRoute(routeBuilder)