title: How to detect device orientation using sensor values?
body: <p>Trying to detect the device orientation using sensors values with the help of two common sensors available in every smart phone Accelerometer &amp; Gyroscope.</p>
  
  <p>In my application, I'm using expo listeners to read values from sensors those are in the form of x,y,z.</p>
  
  <pre><code>  Expo.Accelerometer.addListener((results) =&gt; {
  
             console.log(results)
    })
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code> Object {
      "x": 0.005248264875262976,
      "y": -0.10594243556261063,
      "z": 1.004819393157959,
    }
  </code></pre>
  
  <p>Now my question is how do I accurately convert those x,y,z values in the form of orientation angle. Is it possible or what without ejecting my application?</p>
  
  <p><a href="https://docs.expo.io/versions/v32.0.0/sdk/gyroscope" rel="nofollow noreferrer">Gyroscope</a></p>
  
  <p><a href="https://docs.expo.io/versions/v32.0.0/sdk/accelerometer" rel="nofollow noreferrer">Accelerometer</a></p>
  
  <p><a href="https://docs.expo.io/versions/latest/sdk/devicemotion" rel="nofollow noreferrer">DeviceMotion</a></p>
  
  <p>PS: I don't want to rotate my application layouts to check the phone orientation. In my scenario I have it locked in portrait mode.
  Just need a device angle 0,90,-90 also note my app only depends on expo.</p>