You cannot use the accelerometer to determine the distance.
If I'm at rest, the accelerometer only detects acceleration due to gravity. This obviously set the walking distance to 0.
But if I go at a constant speed and run the application while walking, my acceleration is also zero, so the accelerometer again only detects acceleration due to gravity. The situation is the same as above, and the walking distance is 0, which is incorrect.
Not to mention the difficulties in working with changes in acceleration due to the orientation of the device.
You need Core Location to calculate everything related to distance. You can use the accelerometer to implement a pedometer, but it only takes steps, not distance.
source share