How can I snap the direction of the compass to the direction of the map?
I add a Compass to my MapView and enable map rotation like this:
MapView mapView = findViewById(R.id.mapView);
// Enable & add compass
CompassOverlay compassOverlay = new CompassOverlay(this, mapView);
compassOverlay.enableCompass();
mapView.getOverlays().add(compassOverlay);
// Enable map rotation with gestures
mapView.getOverlays().add(new RotationGestureOverlay(mapView));
Now when the map is not rotated, so up is north, right is east etc, the compass works correctly. But when I rotate the map with gesture, the compass does not move accordingly. So when the device is faced north and the map is at its default rotation, the compass shows north according to the map, which is correct. But when I rotate the map by 90° clockwise, the compass still points up instead of turning 90° clockwise.
I tried using compassOverlay.setPointerMode(true);
but that only changed the appearance of the compass.