A way to tell if someone shakes the phone?

edited January 12 in Android Mode

The Ketai Library has stuff for like onDoubletap, and onFlick, but I can't any thing for onShake, or any other library. does anyone know a way to detect if someone shakes the phone, for my app to respond in the correct way?

Tagged:

Answers

  • You will check the accelerometer data. You need to differentiate between simple changes of acceleration and quick and multiple changes of the acc data. The latter is what would account as a shake. You keep a timer to make sure this quick and multiple acc changes happen within a time frame.

    Kf

  • How would I go about doing that?

  • You'd start by creating an application that logs the sensor data, and then you'd look at those logs to see if you can figure out a pattern.

  • edited January 14

    @coolphill -- shake detection is also a common problem in Android development.

Sign In or Register to comment.