The motion sensors of an accelerometer measure changes in direction and velocity -- acceleration. If you have a mobile device in your pocket while you run, the accelerometer constantly assesses and calculates your movement and cadence as you accelerate into each stride and decelerate slightly after foot strike.
There are dozens, if not hundreds, of running apps available for smartphones on the Apple App Store and the Android Marketplace, but not all of them offer indoor distance tracking. Why is that? It turns out that while using GPS to determine the ground you've covered while running outside is relatively easy, calculating the imaginary distance you cover while running indoors on a treadmill is a little bit tricky.
Alex Macmillan, lead developer for the "Zombies, Run!" app, explains that one of the challenges inherent with using an accelerometer to track a runner's distance on a treadmill is the accelerometer itself. He says that "Accelerometer data can be very 'noisy,' which makes it difficult to interpret. You need to be able to tell the runner's motion apart from the motion of the phone simply rattling around in the runner's pocket."
Another challenge cited by Macmillan is the sheer data load involved in calculating distance statistics. This is tricky because, as he puts it, "You need to read new data (or 'sample') from the accelerometer very frequently in order to get good results. This means you have to write code fast enough to perform all of your calculations in the space between one sample and the next."
Add to those issues the fact that you're not actually going anywhere on a treadmill, and it becomes clear that teaching the tech in your phone to determine your indoor distance is no small feat. So how do developers work with these limitations?