How to do a Step Counter/Pedometer for mobile

Has anyone made a step counter or pedometer function in Haxe for mobile?

Hello!

This should be possible using the openfl.sensors.Accelerometer class. The trick would be detecting when a step has occurred – you probably cannot determine which axis would be “up” for steps as the phone could be held horizontally, in a pocket, so on, however there is probably a rhythm to be detected based on acceleration

Here’s a post on Stack Overflow that may help on the algorithm side:

algorithm - how to calculate exact foot step count using accelerometer in android? - Stack Overflow

Here’s the Accelerometer and a link to an article with a little more code showing what referencing it looks like:

openfl.sensors.Accelerometer - API Reference
Accelerometer in AS3 Air Flash | iOS & Android (sadedar.com)