How does the M7 processor track steps?

Apps which use the M7 chipset to track steps, like the newly released Breeze, how do they do it? Do I need to hold the phone in my hands and ensure that I move my arms to and fro when walking? Or can I just place the phone in my pocket and it will track it?