snctln wrote: > I put up a code snippet over on anddev.org that illustrates how I get > the "shake" movement from the accelerometer for use in my "WordWrench" > game > http://www.anddev.org/example_detecting_-und-quotshake-und-quot_with_the_accelerometer-t4451.html > > Basically the idea is the sum of the 3 values that you get from the > accelerometer will always be equal to the earths gravity when the > phone is at rest, ie it is not moving,(gravity is already defined in > the android framework as SensorManager.GRAVITY_EARTH) > > So basically a shake is happening when the value of the sum of all of > the forces on the phone is greater then some threshold that you > define... I find the 1.5 times of earths gravity to work well, but you > can play with that to see how well it works for you. Make this value > higher to to require a harder shak, and make the value lower to allow > for a softer shake.
Excellent! I was probably aiming too complex, trying to determine the direction of a shake. Many thanks! -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training in Sweden -- http://www.sotrium.com/training.php --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

