How should I calculate azimuth, pitch, orientation when my Android device isn’t flat?

When the device is not flat, you have to call remapCoordinateSystem(inR, AXIS_X, AXIS_Z, outR); before calling getOrientation. The azimuth returns by getOrientation is obtained by orthogonally project the device unit Y axis into the world East-North plane and then calculate the angle between the resulting projection vector and the North axis. Now we normally think … Read more

how to calculate phone’s movement in the vertical direction from rest?

If you integrate the acceleration twice you get position but the error is horrible. It is useless in practice. Here is an explanation why (Google Tech Talk) at 23:20. I highly recommend this video. Now, you do not need anything accurate and that is a different story. The linear acceleration is available after sensor fusion, … Read more

Android accelerometer not working when screen is turned off

Basically, it is a problem with my phone. Other users have reported this also happens with their phones, from different brands but same Android version. Other persons have no problem at all – strongly indicating that this is not a problem with the stock version of android but from the implementations of each company for … Read more

Android TYPE_LINEAR_ACCELERATION sensor – what does it show?

Very interesting question!!!! I’m developing somethig similar to your application. What i found about TYPE_LINEAR_ACCELERATION isn’t happy for me. 1) TYPE_LINEAR_ACCELERATION, TYPE_GRAVITY, ecc are implemented only for Android 2.3 (and up) So i have Android 2.2 and i can’t test them. 2) TYPE_LINEAR_ACCELERATION isn’t so accurate as it would be, because there are some simple … Read more

Convert magnetic field X, Y, Z values from device into global reference frame

In my comment on the checked answer on the link you provided above, I referred to my simple answer at calculate acceleration in reference to true north Let me answer here again with more clarification. The answer is the product of the rotation matrix and the magnetic field values. If you read further on the … Read more