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.

Feel free to download the lite version of WordWrench (available in the
market games->Brain and Puzzle) to see the code in action (feel even
more free to download the 99 cent WordWrench Full) they both have
"Shake to Wrench" functionality built in, which basically mean that
once the game starts you can shake the phone to rearrange the bottom
letters.

Let me know if this helps at all.

---snctln
www.snctln.com

On Mar 1, 10:44 pm, gganesh <[email protected]> wrote:
> hi,
> Is there any Listener  able to listen for shake movement   .
> when someone shakes the phone an event should  be triggered ,how I'm
> supposed to do that ,any idea on this topic is appreciable.
> Thanks
> ganesh
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to