Orientate map in OSMDROID 3.0.6


I am working on a project and one of the feature I would like to implement, is a map that turns whenever you turn.

I have made some researches and found out this code (from http://code.google.com/p/osmdroid/source/browse/branches/rotation/OpenStreetMapViewer/src/org/osmdroid/MapActivity.java?r=914)):

mOsmv.setMapOrientation(currentOrientation += 45);

It would be perfect, if it would work.

I am also wondering if I can use some sort of compass listener, in order to have a map that turns in real time (in that example, the user, by clicking on a menu, can rotate the map of 45degrees).
I know, I could also use a SensorListener, but of course I am checking whether there was something faster. Because using a SensorListener, I would then need to calculate azimuth and stuff like that. But, I need first to find the correct way to rotate the map using the version 3.0.6.

I believe they might have changed the way you can orientate it.
I have found ‘rotate’, but it simply physically rotate the mapView.

Thanks in advance,


I have not been busy with OSMDroid yet,

but have a look at OsmAnd … there are features like listening to compass, and it is opensource.