1

I am trying to get the angle of the device in the range of [0, 2π). Like This The angle of the device 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.

Euler Angles

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.

Ge3ng
  • 1,875
  • 1
  • 24
  • 38

1 Answers1

0

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

Community
  • 1
  • 1
RajeshVijayakumar
  • 10,281
  • 11
  • 57
  • 84
  • I need the angle of the device itself so I have to use the sensors. – Ge3ng Nov 12 '12 at 23:54
  • The first tutorial uses the orientation sensor which is depricated. The other one uses SensorManager.getOrientation which gives Euler Angles unfortunately neither of these work. – Ge3ng Nov 13 '12 at 15:29
  • Orientation Sensor is deprecated but works as well (or should I say as bad) as the other method which consists in computing both Accelerometer values and Magnetic Field ones. Getting original orientation is just hopeless on those devices *sigh*. – PeterGriffin Nov 28 '12 at 10:35