This sample is a dice roll app that use the accelerometer to detect shake and generate a random number between 1 and 6.
https://github.com/josejuansanchez/android-sensors-overview/tree/master/examples/diceshaker