[TIMOB-116] Shake Gesture unstable (Android)
|Fix Version/s||Release 0.7.0|
The shake algorithm in Android has always been difficult or too easy to trigger depending on the amount of motion of the device. http://support.appcelerator.net/discussions/titanium-mobile-discussion/349-issue-with-event-listener-for-shake-gesture-on-android"> Issue with event listener for "shake" gesture on Android.
A couple of notes regarding listeners.
1) When the activity (window) is paused via the Android onPause
method, the hardware listeners are disconnected.
2) If you press end and put your phone to sleep, onPause will be called if your app was active.
3) If you press home, answer a call, or a notification, onPause is called.
4) If another activity/window completely covers your application onPause is called.
5) If your app was active, you press end to put it to sleep, then you cause the device to wake even if you don't unlock the display, onResume will be called and the hardware listeners restored.
What this means is that if you put the phone in your pocket, purse, or just hit a hardware key. Your application is resumed.
- Don Thorp 2011-04-15
(from [d4aaf77edad820df2831af82ed97e03e45bf7528]) [#116 state:resolved] Changed shake gesture to respond to shake motion more reliably. Added three new system properties for tuning:
1) ti.android.shake.factor - double - default 1.3d - used to build threshold value for accelerometer changes that should be considered a potential shake
2) ti.android.shake.quiet.milliseconds - int - default 500 - the number of milliseconds of no shaking after shaking has started that will cause the shake event to fire.
3) ti.android.shake.active.milliseconds - int - default 1000 - the number of milliseconds that shaking must occur before allowing shake event to fire. The quiet period must elapse before this value is considered.
These properties may be set in your tiapp.xml to tune the shake algorithm on android devices