We added the inertial integration of acceleration (global frame) to velocity and to position to check out the limits of what is possible with consumer grade accelerometer, magnetometer and gyroscope sensors. Our conclusion is that inertial navigation is not feasible with the current generation of consumer devices. There are two fundamental problems. The first is that the problem is mathematically unconstrained so integration errors from sensor errors accumulate quadratically. The second is that we live in a 1g gravity field so that orientation must be known precisely in order to subtract off the 1g gravity field.
Take a look at the accelerometer display in the Sensors tab. You'll see that the magnitude of the accelerometer output even at rest is not precisely 1g. So when we subtract off the 1g gravity field we have a small residual acceleration error which very quickly leads to significant positional errors within a short time of order seconds.
The source code highlights this with the comment:
// integrate the acceleration to velocity and displacement in the global frame.
// Note: integration errors accumulate without limit over time and this code should only be
// used for inertial integration of the order of seconds.
: