I have made android app that plays next song when shake once using Accelerometer.
Now what i want my in app if a shake the phone in right side it should play the next song in line or if shake in left play previous, can i do it with the logic of axis found at time of shake action if that is possible how can I put axis to the methods of motion detection to know the direction in which the mobile is shaked. If any one have a logic for this please help i am stuck here.
I did some digging into this and was able to resolve it myself. but while posting the answer I found this answer by Basil which explains better than my implementation. So, i found it more helpful.
In the onSensorChanged whenever the device receives new value it store the values into variables after some delay. After that compares the new value with previous values beautifully. Which leads to calculate into direction the device has shakes. If the answer is still unclear let me know.