Android motion events... a good shake!

Nicolas Cueto niconiko at gmail.com
Wed Jun 20 06:58:50 EDT 2012


Hello All,

Want a change to happen only if the Android device has been given a
loooong shake.

Here was my first thought on how to do this:

/////////////////////////////////////////////////////////
local tMotionStartMillisecs

on motionStart
 put the milliseconds into tMotionStartMillisecs
end motionStart

on motionEnd
   put the milliseconds - tMotionStartMillisecs into tMillisecDiff
   if tMillisecDiff > 3000 then
      send doTheChange to me in 0 milliseconds
    end if
end motionEnd
////////////////////////////////////////////////////////////

Problem is, motionEnd gets called even though the device is, according
to my senses, still being shaken. I guess my sense of an uninterrupted
shake differs from the device's/LC's assessment.

Any other way to do this?

Thanks.

--
Nicolas Cueto




More information about the use-livecode mailing list