Accelerometers *can* depending on their quality be very sensitive. I don’t know how sensitive ones in mobile devices are.
That said, nothing sits perfectly still, so it’s possible it could be picking up floor vibrations. But more likely it’s in the Analog to Digital conversion process. Electricity is a wave form and the amplitude of the wave is how much movement is going on and it’s continuous. The AtoD converter samples the signal at a frequency set in the device. Maybe it’s 60 times per second, perhaps faster, perhaps slower. It captures the amplitude of the electric wave on its sample period. Let’s say just for sake of discussion, the wave peaks at 100 and -100 on a typical sine wave. Depending on the sample interval, it could return 100, 50, 0, -32 etc. even while the device is sitting still. You’re going to get that value back.
Now the OS may be trying to smooth that out. We are running another level of filtering to try and smooth it out, but it has to be a balance between as much accuracy as possible vs. smoothness.
To your question, it’s hard to answer because it could be picking up micro-vibrations even while sitting still or it could just be jitter. It comes down to what you think the definition of “still” is. Lua numbers have 54 bits of floating point number resolution which can hold very precise numbers.
Personally if you don’t need high accuracy values, you could do something like:
local moveX = math.floor( event.xGravity \* 1000 ) / 1000
that would whack off a lot of the minor resolution (maybe you need 10,000, 100,000 or even 1,000,000 depending on your needs) to smooth that value out more in particular if you want to know 'isMoving" or “isStill”.
Rob