Question

I want to count number of shake horizontally and vertically, I have referred to UIAcceleration

I have also referred to Motion Events

But couldn't come up with better approach. Any kind of help is highly appreciated , code , reference, or any type.

i just want to count the number of shake user make by shaking the iphone device, the shake can be vertically or horizontally holding iphone in normal way(home key at the bottom)

Was it helpful?

Solution

Try DiceShaker. You'll need to use the code for "Isolating Instantaneous Motion from Acceleration Data" given in Listing 4-6 of the motion events (also called high-pass filter computation) documentation to detect acceleration provided by user.

EDIT: The accelerometer constantly provides the gravity component readings because the accelerometer works with a bunch of springs that determine the force component (in the direction of each spring's length) by the increase/decrease in the spring's length. So just remove the constant gravity(the force that's ALWAYS working) component to detect the change provided by the user (hence the name high-pass). Luckily, we don't need to figure out how to because Apple has done the hard work and given the equations in their documentation!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top