Search code examples
androidrotationskmaps

Skobbler Maps - Stop rotation during navigation


I am calculating a route using SKRouteManager as follows:

route.setStartCoordinate(origCoords);
route.setDestinationCoordinate(destCoords);
route.setNoOfRoutes(1);
route.setRouteMode(SKRouteSettings.SKRouteMode.BICYCLE_FASTEST);
route.setRouteExposed(true);
SKRouteManager.getInstance().setRouteListener(thisActivity);
SKRouteManager.getInstance().calculateRoute(route);

I am then implementing the onAllRoutesCompleted() callback to initiate turn by turn navigation:

public void onAllRoutesCompleted() {
    SKNavigationSettings navigationSettings = new SKNavigationSettings();
    navigationSettings.setNavigationType(SKNavigationSettings.SKNavigationType.SIMULATION);

    SKNavigationManager navigationManager = SKNavigationManager.getInstance();
    navigationManager.setMapView(mapView);
    navigationManager.setNavigationListener(this);
    navigationManager.startNavigation(navigationSettings);
}

My problem is that it now automatically rotates the map toward the direction of travel - but I want the map to always point north (unless the user chooses otherwise).

How can I stop the rotation changing due to turn-by-turn navigation?


Solution

  • You need to modify the map's follow mode via setFollowerMode. If you want to just follow the user position, but not to rotate the map, set it to POSITION, something like:

    mapView.getMapSettings().setFollowerMode(SKMapFollowerMode.POSITION);