OnRouteCalculationCompleted Method Called More than Once

59 Views Asked by At

Why is onRouteCalculationCompleted called more than once altough I specified the maximum returned route number to 1? Here is the code:

private void launchRouteCalculation(SKCoordinate startPoint, SKCoordinate destinationPoint) {
    Log.i(TAG, "launchRouteCalculation called");
    //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 drift_routes to be calculated
    route.setMaximumReturnedRoutes(1);

    route.setRequestExtendedPoints(true);

    // set the route mode
    route.setRouteMode(SKRouteSettings.SKRouteMode.CAR_FASTEST);
    // 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);
}
0

There are 0 best solutions below