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.