I want to detect a movement like a Moo Box, I reverse the phone and when I turn it back it fire an action…
For Android.
What is the best way
It is possible to custom an event listenner
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Did you look at SensorManager?
There’s a very good tutorial here: http://www.ibm.com/developerworks/opensource/library/os-android-sensor/
Update after question editing:
SensorEventListener is an interface, not a class, so you are forced to implement your code in the two callbacks:
You will be more interested in the second one.
Please, take a look at the tutorial I posted above. Half-way through there is an accelerometer example:
You will have to analyze the movement pattern you want to detect and create a listener that reacts accordingly.