Last time I worked on a compass reading (which was years ago), I did 
something like this. 

A:
http://www.javacodegeeks.com/2013/09/android-compass-code-example.html

Of course, this example has a locked portrait orientation. 

So, I call something like this to get it in sync. 
http://developer.android.com/reference/android/view/Display.html#getRotation()

Now, I realize that some of the calls in example A are deprecated. Many 
devices with which I am familiar, though, it actually does work. 

That's why, if I were to do a new implementation today, I might consider 
something like implementation B.   

B:
http://sunil-android.blogspot.com/2013/02/create-our-android-compass.html

I have no good way of testing either method on all of today's gazillion 
Android devices, so I am going to have to use a best practice, and try to 
blame the user's device when they don't work. 

So my questions are:
1. Does implementation B already take into account landscape/portrait 
orientation of the device, or should I continue to use Display.getRotation?
2. Are there known devices for which A fails and B works or vice versa?
3. Are there devices with usable sensors for which neither A or B works?
4. Are there any known drawbacks of implementation B?

Nathan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to