Nexus 5 features two new sensors: step detector and step counter
The Nexus 5 is the first device we know to have these two sensors built in, but it likely won’t remain the only one for long. Android 4.4 KitKat opens platform support for these new sensors so other phones can integrate them as well.
How does it all work? Simple - the accelerometer detects when you’ve taken a step and the counter, well.. counts them. All of that detection happens in the system so developers do not need to write code for the step detection, and that’s neat.
source: Android Developer