1

I want to detect orientation changes when using a fixed orientation (natural) portrait mode. Following this question responses How to measure the tilt of the phone in XY plane using accelerometer in Android I'm able to do it when the phone is not laying flat but it's not clear to me how to do it the other way around.

crit_
  • 33
  • 8

1 Answers1

0

Yes You Detect Orientation Changes.

I hope My Gist will Be Helps You.

https://gist.github.com/fakefacebook/c07e15cb487d456d94ebaa15bbfeeedf

Nikunj Paradva
  • 15,332
  • 5
  • 54
  • 65
  • Thanks for your response, so, you're ignoring the event when it fails? `if (prevOrientation != currentOrientation && orientation != OrientationEventListener.ORIENTATION_UNKNOWN) {...` – crit_ Mar 14 '18 at 02:52
  • no It ll Compares with Old Detected Orientation.because when Only Orientation Changes That time You Detect That. It ll not Repeat Same Orientation – Nikunj Paradva Mar 14 '18 at 04:15