In the demo project (3.0.1), with the traffic API enabled, I modified the launchRouteCalculation method to reflect your settings:
Code:
private void launchRouteCalculation(SKCoordinate startPoint, SKCoordinate destinationPoint) {
clearRouteFromCache();
// get a route object and populate it with the desired properties
SKRouteSettings route = new SKRouteSettings();
// set start and destination points
route.setStartCoordinate(startPoint);
route.setDestinationCoordinate(destinationPoint);
// set the number of routes to be calculated
route.setMaximumReturnedRoutes(1);
// set the route mode
route.setRouteMode(SKRouteMode.CAR_FASTEST);
route.setUseLiveTraffic(true);
route.setUseLiveTrafficETA(true);
SKRouteRestrictions restrictions = new SKRouteRestrictions();
restrictions.setTollRoadsAvoided(true);
restrictions.setHighWaysAvoided(false);
restrictions.setFerriesAvoided(false);
route.setRouteRestrictions(restrictions);
SKRouteManager.getInstance().setTrafficRoutingMode(SKMapSettings.SKTrafficMode.FLOW_AND_INCIDENTS);
// set whether the route should be shown on the map after it's computed
route.setRouteExposed(true);
// set the route listener to be notified of route calculation
// events
SKRouteManager.getInstance().setRouteListener(this);
// pass the route to the calculation routine
SKRouteManager.getInstance().calculateRoute(route);
}
using
Code:
launchRouteCalculation(new SKCoordinate(28.426912,-81.3065897), new SKCoordinate(28.450522, -81.356446));
The generated route correctly avoids toll roads route without toll roads.jpg
Bookmarks