2
我使用Skobbler樣品的Android SDK(從here下載)來編寫導航應用,它完美的作品,如果我跑在Android Studio應用程序,但是當我安裝應用程序中使用生成的APK,它通常會失敗在路線計算,並在日誌中我得到的是:路由計算失敗,模擬重路由
06-04 10:09:43.435 6285-6285/com.skobbler.sdkdemo D/SKMaps﹕ [email protected] 11.0
06-04 10:09:43.435 6285-6285/com.skobbler.sdkdemo D/SKMaps﹕ SKMapSurfaceView---- centerMapOnPosition [101.6156902,3.0311728]
06-04 10:09:43.435 6285-6285/com.skobbler.sdkdemo D/SKMaps﹕ SKRouteManager---- @clearAllRoutesFromCache
06-04 10:09:43.436 6285-6285/com.skobbler.sdkdemo D/SKMaps﹕ SKRouteManager---- @calculateRoute SKRouteSettings [startCoordinate=[101.6156902,3.0311728], destinationCoordinate=[101.6156,3.03496], routeMode=CAR_FASTEST, alternativeRouteModes=null, routeConnectionMode=HYBRID, downloadRouteCorridor=true, routeCorridorWidthInMeters=2000, waitForCorridorDownload=false, destinationIsPoint=true, tollRoadsAvoided=false, highWaysAvoided=false, avoidFerries=false, noOfRoutes=1, countryCodesReturned=false, extendedPointsReturned=false, viaPoints=null, useRoadSlopes=false, exposeRoute=true, filterAlternatives=false, requestAdvices=true, bicycleWalk= false, bicycleCarryAvoided= false]
06-04 10:09:43.437 6285-6285/com.skobbler.sdkdemo D/SKMaps﹕ [email protected]
06-04 10:09:43.437 6285-6285/com.skobbler.sdkdemo D/SkobblerNG﹕ clear route
06-04 10:09:43.437 6285-6285/com.skobbler.sdkdemo D/SkobblerNG﹕ clear route final
06-04 10:09:43.439 6285-6285/com.skobbler.sdkdemo D/SKMaps﹕ SKUtils----Return calculated device type HIGH
06-04 10:09:43.440 6285-6285/com.skobbler.sdkdemo D/SKMaps﹕ SKRouteManager---- Calculate route setroute SKRouteSettings [startCoordinate=[101.6156902,3.0311728], destinationCoordinate=[101.6156,3.03496], routeMode=CAR_FASTEST, alternativeRouteModes=null, routeConnectionMode=HYBRID, downloadRouteCorridor=true, routeCorridorWidthInMeters=2000, waitForCorridorDownload=false, destinationIsPoint=true, tollRoadsAvoided=false, highWaysAvoided=false, avoidFerries=false, noOfRoutes=1, countryCodesReturned=false, extendedPointsReturned=false, viaPoints=null, useRoadSlopes=false, exposeRoute=true, filterAlternatives=false, requestAdvices=true, bicycleWalk= false, bicycleCarryAvoided= false]
06-04 10:09:43.440 6285-6285/com.skobbler.sdkdemo D/SkobblerNG﹕ Java_com_skobbler_ngx_routing_SKRouteManager_setroute
06-04 10:09:43.440 6285-6285/com.skobbler.sdkdemo D/SkobblerNG﹕ No Via points added to the route
06-04 10:09:43.442 6285-6285/com.skobbler.sdkdemo D/SkobblerNG﹕ Java_com_skobbler_ngx_routing_SKRouteManager_setroute final
06-04 10:09:43.445 6285-6344/com.skobbler.sdkdemo D/SKMaps﹕ SKRouteManager---- @onRouteCalculationFailed called with SKRoutingErrorCode =ROUTE_CANNOT_BE_CALCULATED
06-04 10:09:43.447 6285-6344/com.skobbler.sdkdemo W/SKMaps﹕ SKRouteManager---- @onAllRoutesCompleted called
此外,有沒有什麼辦法在SKNavigationType.SIMULATION
模式下使用導航時simluate重新路由? 我想明確地改變內部onCurrentPositionUpdate(SKPosition currentPosition)
方法類似這樣的當前用戶的位置,但它不工作:
@Override
public void onCurrentPositionUpdate(SKPosition currentPosition) {
iteration++;
this.currentPosition = currentPosition;
if (mapView != null) {
if(iteration >= 5) {
Toast.makeText(MapActivity.this, "Changed location", Toast.LENGTH_LONG).show();
this.currentPosition = new SKPosition();
this.currentPosition.setCoordinate(new SKCoordinate(101.618133, 3.025863));
}
mapView.reportNewGPSPosition(this.currentPosition);
}
}
爲了模擬重新路由,你必須使用從SKNavigationManager的blockRoad方法。請點擊這裏查看DOC:http://developer.skobbler.ro/docs/android/com/skobbler/ngx/navigation/SKNavigationManager.html#blockRoad%28double%29 – SylviA
@SylviA您的評論應該是答案,因爲它是利用工作blockRoad方法 – Waqas
@Waqas你有沒有想過你的ROUTE_CANNOT_BE_CALCULATED錯誤的原因?如果包含當前未被mapview緩存的點,我已經看到任何我嘗試計算的路線失敗的問題。通常在這種情況下,HYBRID或ONLINE的connectionMode應該規定SDK調用Skobbler API來確定路由信息,但是我沒有看到發生在我的情況中,並且想知道這是否是您經歷的。感謝您的任何見解! – Keith