PDA

View Full Version : Why RouteCompleteCallback called two times?



FatihA
08.02.2015, 22:10
Hello,

in my App I calculate a route after finishing the calculation the RouteCompleteCallback is called two times.

02-08 21:01:36.624 6481-6514/D/SKMaps﹕ SKRouteManager----RouteCompleteCallback Distance=3002629 Status=600 CompleteRoute=false 508058
02-08 21:01:36.744 6481-6481/D/SKMaps﹕ SKMapSurfaceView----Set map follower mode NONE
02-08 21:01:36.754 6481-6481/D/SKMaps﹕ SKRouteManager---- Zoom to route 1.0 1.0 8 8 8 8
02-08 21:02:04.954 6481-6514/D/SKMaps﹕ SKRouteManager----RouteCompleteCallback Distance=3002629 Status=600 CompleteRoute=true 508058
02-08 21:02:05.014 6481-6481/D/SKMaps﹕ SKMapSurfaceView----Set map follower mode NONE
02-08 21:02:05.014 6481-6481/D/SKMaps﹕ SKRouteManager---- Zoom to route 1.0 1.0 8 8 8 8

In first call I see that the CompleteRoute is false and the second call true.
But why the first calculation is false? I see not any other difference between the two RouteCompleteCallback, distance and status etc. is the same.
Is that normal?

dandronic
09.02.2015, 08:51
Similar to http://forum.skobbler.com/showthread.php/6696-Route-rendering-problems-in-iOS

For convenience:
The didFinishRouteCalculationWithInfo: method is called twice but it's actually the same route (if you look at the routeID it's the same). The reason is that if you want to make a navigation and it's a long route the route calculation could take longer. The first time didFinishRouteCalculationWithInfo: is called the route may not be completely calculated (just a few tens of kilometers at the beginning) but you can start navigating on it. To check if the route is completely finished you should just check if routeInformation.corridorIsDownloaded is YES.

The documentation for 2.4 has been update to correctly reflect the above

FatihA
09.02.2015, 22:38
Hey dandronic,

thank you. It helps a lot.
Now I'am understanding why it is calling two times.