I'm now trying to understand how to allow for the display orientation
in my simple compass calculation, since I don't think there is an API
that does that for me.

It looks like the "right way" to get this is

    getWindowManager().getDefaultDisplay().getRotation()

which returns values  Surface.ROTATION_0 ...  Surface.ROTATION_270.

But that is only available in API version 8, which I don't have.

There is a deprecated method Display.getOrientation().  Perhaps that
is what I'm supposed to use, however its docs seem to have been
removed when it was deprecated (Please Don't Do That!).  Googling
suggests that perhaps it returns values like
Configuration.ORIENTATION_PORTRAIT and
Configuration.ORIENTATION_LANDSCAPE, i.e. not including "left" or
"right" or "upside-down" information, making it useless.

Surely there must be some easy way to do this?

(Related question: compass calibration.  Is there ever anything like
the iPhone's calibration dialog?  I wasted much of this morning
thinking there was something wrong with my code, until I realised that
the compass also didn't work in Google Maps on my Galaxy Tab.  I spent
a few minutes slowly turning the device on each axis a few times and
it now works better.  This is the sort of issue that users will blame
on the app, and that will be impossible to debug remotely...)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to