Now that SENSOR_ORIENTATION is deprecated, what's the best practice for obtaining compass heading? The old way was so simple.
A:
SensorManager.getOrientation(float[] R, float[] values) is the standard API call to use since API level 3.
CodeFusionMobile
2010-08-18 18:32:30
Yeah, I found that in the documentation. Two more questions: what do you initialize R and values to? Also, is there a way to get notifications, or is that whole working model deprecated?
Edward Falk
2010-08-19 03:44:38
OK, found a good example in the source base. I won't copy it here, but if you browse the git repository for Android, look at the end of development/samples/Compass/src/com/example/android/compass/CompassActivity.java
Edward Falk
2010-08-19 15:54:13
Notifications/events is a poor way to do sensors, which is why it's deprectated afaik. Every minor aspect change would trigger a multitude of events, essentially choking the UI thread with data.
CodeFusionMobile
2010-08-20 14:08:11