Has anyone made a step counter or pedometer function in Haxe for mobile?
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:
Accelerometer and a link to an article with a little more code showing what referencing it looks like: