On Mon, Jul 12, 2010 at 12:56 AM, Brad Gies <[email protected]> wrote: > A half shake is the act of moving your phone from one position to another > (and probably more or less about 4 inches or more). A full shake would be > the act of moving the phone to another position and back again.
OK. > Now... in a half shake the following would happen.. A high acceleration when > you start moving the phone.. followed by a low acceleration when you reach > full speed.. then a high negative acceleration when you begin stopping and a > low acceleration when you are close to stopping, and from the first high > acceleration to the last low acceleration the phone should have moved at > least a couple of inches. A full shake would just be two half shakes in a > row in less than a second or at most two. That's all true (and I was incorrect in my previous post, my apologies). Note, though, that you will have zero acceleration at some point along the way -- you cannot pass from a positive acceleration to a negative acceleration without going through zero. > Oh.. and you are using SENSOR_DELAY_UI and I was using SENSOR_DELAY_GAME > when I registered the Listener. Any idea of what the real difference is > between the two? SENSOR_DELAY_GAME has two extra letters. :-) Beyond that, and the fact that GAME must be more frequent than UI as you noted, I have not researched further. > One question though... What is the rationale for squaring the GRAVITY_EARTH > constant to calculate your threshold? Is that just your interpretation of > what force a Shake would be, and then adjust from there, or is there > something more scientific behind it? The net acceleration is the square root of the sum of the squares of the X, Y, and Z accelerations. Think of it as 3D Pythagorean theorem. Since sqrt() is slow, I do my comparisons against the squares of the acceleration. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

