I\'m using the code of MapsDemo Sample to draw a Map that rotates according to the compass, but enableCompass is not working to show the compass on MapView. I tried to add this
Bear in mind that it will only work on actual hardware.
Put this line in onCreate
:
MyLocationOverlay me = new MyLocationOverlay(this, mapView);
mapView.getOverlays().add(me);
Then add this:
@Override
protected void onResume() {
super.onResume();
me.enableCompass();
}
@Override
public void onPause() {
super.onPause();
me.disableCompass();
}
Here is a sample project that enables the compass on MyLocationOverlay
that definitely works, though you will need to substitute in your own android:apiKey
value.