Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 4.4 Step Detector and Counter

Is there any documentation around Android 4.4 KitKat's (well specifically Nexus 5 for now) step detector and counter APIs? I tried to search a lot but did not find anything.

I am planning to try my hands on these new concepts and want to use the API but there's nothing around it on the Internet.

like image 487
hvkale Avatar asked Dec 04 '13 05:12

hvkale


2 Answers

I found an example for you, hope it helps in someway, the sensor explanation on the API page is pretty straight forward too..

API Page: http://developer.android.com/about/versions/android-4.4.html#UserInput

Blog Post: http://theelfismike.wordpress.com/2013/11/10/android-4-4-kitkat-step-detector-code/ Github Project referenced in the blog: https://github.com/theelfismike/android-step-counter

like image 76
Rejinderi Avatar answered Oct 16 '22 20:10

Rejinderi


Official example

In Android SDK 23 under samples/android-23/sensors/BatchStepSensor, run with:

./gradlew clean
./gradlew assembleDebug
./gradlew installDebug

Then turn on the app, enable one of the step sensors, and walk around with your phone to see the counter increment.

Source at: https://github.com/googlesamples/android-BatchStepSensor