Get Android rotation angle in x-axis
15,451
There is azimuth, pitch and roll available to you. Not sure which one relates to your "x-axis" but I think its azimuth.
Time for helpful links:
- http://www.workingfromhere.com/blog/2009/03/30/orientation-sensor-tips-in-android/
- http://marakana.com/forums/android/examples/43.html
- http://marakana.com/static/tutorials/SensorDemo.zip
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Author by
Admin
Updated on June 24, 2022Comments
-
Admin about 2 years
I'm experimenting with some Android functions. Right now, I'm trying to get the rotation angle of the device, so when I show a happy face bitmap on a canvas, it always looks "straight".
All I would need for this, is to get the x-axis rotation angle (I guess) but I can't find how to achieve it. Hope you can help me. Thank you.
-
Admin almost 12 yearsIt works perfectly! azimuth is a little slow, but does the job! Thanks a lot. Just one thing that worries me, as it says that SensorListener and SENSOR_ORIENTATION are now deprecated... This means there is a new way to do so, right?
-
Admin almost 12 yearsI must add. With Marakana's example in mind, i modified it slightly to use SensorEventListener and Sensor.TYPE_ORIENTATION instead. The response is quite faster, and now the only deprecated object is Sensor.TYPE_ORIENTATION. I'll leave it this way for now, since the new "solution" is quite more complex and gives the same result. Thank you for all!
-
MonoThreaded about 9 yearsPlease note SENSOR_ORIENTATION is deprecated