Android-CMD-Group/Radar-Detector — Issue #8: Criteria for detecting a shake?
Author: rcmontoy
Created: 2012-03-02 11:17:15+00:00
State: open
Labels: enhancement, question

Tonight I implemented a very basic method of detecting a device shake. It uses the acceleration of the device along the x, y, and z and calculates the change in acceleration. If the change in acceleration (float delta) is greater than a specified threshold (ACCEL_THRESHOLD) the shake is registered and will appear in LogCat.

Now I'm trying to think of a good way to register a "legitimate" shake - one that is not easily mistaken for an error. So far, I have two options and I need your opinion for more...

1) Keep it the way it is and determine a good change in acceleration threshold
2) Register the number of shakes that are greater than the threshold (ex. 3 good shakes == legitimate shake)
3) ???

Here is a link with more information about SensorEvents. See the portion about 'public final float[] values'
http://developer.android.com/reference/android/hardware/SensorEvent.html