title: Get device angle by using getOrientation() function
body: <p>I was using <code>Sensor.TYPE_ORIENTATION</code> to determine current angle of device but <code>TYPE_ORIENTATION</code> is deprecated on <strong>API version 8</strong>. In SensorManager manual it refers to <code>getOrientation()</code> function in order to use <code>TYPE_ORIENTATION</code>.</p>
  
  <p><a href="http://developer.android.com/reference/android/hardware/SensorManager.html#getOrientation(float%5C[%5C],%20float%5C[%5C])" rel="noreferrer"><strong>Here is the manual</strong></a></p>
  
  <hr>
  
  <p>Here is my old code : </p>
  
  <pre><code>public void onSensorChanged(SensorEvent event) {
          Log.d("debug","Sensor Changed");
          if (event.sensor.getType()==Sensor.TYPE_ORIENTATION) {
              Log.d("debug",Float.toString(event.values[0]));
  
  
              float mAzimuth = event.values[0];
              float mPitch = event.values[1];
              float mRoll = event.values[2];
  
              Log.d("debug","mAzimuth :"+Float.toString(mAzimuth));
              Log.d("debug","mPitch :"+Float.toString(mPitch));
              Log.d("debug","mRoll :"+Float.toString(mRoll));
          }
  
      }
  </code></pre>
  
  <p>I'm really confused about using <code>getOrientation()</code> function, can anyone please show me an example how to get the angles? </p>