Q: Android Get angle of device in the YZ Plane I am trying to get the angle of the device in the range of [0, 2π).
Like This

The Orientation Sensor is deprecated so I can't use that.
The SensorManager.getOrientation() gives the orientation in Eurler Angles which break if I hold the device vertical, because Eurler angles are in the range of [-π/2, π/2]. Points in the 2nd and 3rd quadrants are indistinguishable from the points in the 1st and 4th quadrants. So I don't know which side of the Y axis I am on.

I am limited to use of API level 8 (Android 2.2) so I only have the accelerometer and magnetic field sensors available to use.

A: Try this, It might help you,,
I hope this will solve your issue
http://capycoding.blogspot.in/2012/10/get-angle-from-sensor-in-android.html
Look at this post 1
Look at this post 2
