For my App I need to calculate the acceleration of my device in reference to true north. My idea was to calculate the device orientation to magnetic north and apply the declination to it to get the orientation to true north. Then I want to calculate the acceleration of the device and reference it to the orientation, but I do not know how I should do this.
I would try to get the device orientation using SensorManager.getRotationMatrix()
and SensorManager.getOrientation()
. Then I get the declination by GeomagneticField.getDeclination()
and apply it on the azimuth of the orientation values from SensorManager.getOrientation()
.
But how do I map the accelerometer values to this orientation? Is it even possible?