0

I am trying to find the compass type angle, ie. when device is kept parallel to the ground and then if you rotate it along the line passing through the table. eg. the one mentioned in How to detect android device rotation parallel to the ground?

But the problem with above question which is already answered is that one of the link isn't working and other shows ORIENTATION_TYPE which is deprecated.

Currently I am using TYPE_ROTATION_VECTOR, which gives Roll(holding device with your face watching forward and device facing you and then tilting it to left and right) and pitch(again holding device with straight face forward and try to keep it on table). These are calculated accurately. But the azimuth angle which this TYPE_ROTATION_VECTOR provides, is (again keep the device with your face forward and then device faces you and then rotate it along the line going from floor to ceiling).

So, how to actually calculate accurately the angle when device is kept on table and you rotate it along the line passing from floor to ceiling?

Apologies if I am unclear as its difficult to explain in words. If I am not clear, will try to explain with images.

Tushar Seth
  • 563
  • 7
  • 15
  • The deprecation message says to call `SensorManager.getOrientation()` instead. Why doesn't that work for you? – Ben P. Oct 22 '19 at 22:03
  • that is what I am using for TYPE_ROTATION_VECTOR . But TYPE_ROTATION_VECTOR gives angles when the phone is kept standing. I need angles when phone is kept on table and then rotated. how to do that ? – Tushar Seth Oct 24 '19 at 07:42

0 Answers0