Hhmm, i think you want to take too much steps at once
My suggestion is to split your pedometer in smaller parts and when you achieved all the smaller steps you can combine them to your project.
Suggested worklow:
1)
Make an app that knows if your phone is facing up or down.
When done add a function that counts how often you flipped your phone
2)
Make an app that reacts if you shake your phone
When done you can add a measurement of the shaking
3)
Think about how your phone is shaked while beeing in your pocket while walking.
Try to translate that thoughts to to conditions for your measurement app