Acceleration from device’s coordinate system into absolute coordinate system
I finally managed to solve it! So to get acceleration vector in Earth’s coordinate system you need to: get rotation matrix (float[16] so it could be used later by android.opengl.Matrix class) from SensorManager.getRotationMatrix() (using SENSOR.TYPE_GRAVITY and SENSOR.TYPE_MAGNETIC_FIELD sensors values as parameters), use android.opengl.Matrix.invertM() on the rotation matrix to invert it (not transpose!), use Sensor.TYPE_LINEAR_ACCELERATION sensor … Read more