Search code examples
javaandroidnavigationandroid-sensors

Android sensors (motion)


I am building this android app for jogging which is supposed to measure the distance the user made from a starting point in time.

I am not interested using the GPS option (longtitude, latitude), so without the GPS option and using the android sensors only, how can I calculate the distance the device has been made as a function of time?


Solution

  • Your best bet is to detect "shake" motions within your app and then use that to determine distance (i.e. one shake equals one step, roughly 2000 steps is one mile). Of course, you'll probably want to fine-tune the sensitivity to determine how much motion is required to count as one step.

    There's a handy tutorial for detecting shake motions here: http://www.clingmarks.com/how-to-detect-shake-motion-on-android-phone/25