mobileEnableAccelerometer question...

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

mobileEnableAccelerometer question...

Post by paulsr » Sun Mar 24, 2013 12:20 pm

Greetings:

I am wondering, is there an error in the documentation.
Syntax:
mobileEnableAccelerometer [interval]

The mobileEnableAccelerometer command enables the accelerometer on the device.

The interval is specified in seconds and is the approximate time between delivery of messages.
The way I read that, it means I can define how often I want the accelerationChanged handler to send me updates. But, no matter what value I set for "interval" I seem to get an instant update any time there is any kind of movement.

I only have to tap my iPad to get an acceleration changed message. In fact, I only need to tap my desk.

The documentation says the interval is in seconds, but shows an example of 100. So, I guessing it means milliseconds. I've tried setting 2000, but still get an instant reading from the accelerometer.

Am I right in thinking the "interval" value does nothing?

TIA...

--paul

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: mobileEnableAccelerometer question...

Post by Simon » Sun Mar 24, 2013 9:36 pm

Hi Paul,
Form the dictionary:
Note: The interval is constrained by hardware-specific minimums and maximums (which are left unspecified by Apple).
Nice, unspecified... No way of knowing what an interval is.
Probably best you just read the accelerationChanged message when you want the information not the other way around.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

paulsr
Posts: 222
Joined: Thu Jul 19, 2012 9:47 am
Contact:

Re: mobileEnableAccelerometer question...

Post by paulsr » Mon Mar 25, 2013 2:44 am

Yeah, thanks Simon ... I did spot that, but assumed LC would only give me an acceleration changed notification if the iPad's interval was greater than the one I had requested. (If that makes any sense.) So, I think I'm right in saying the "interval" parameter doesn't do anything.

I'm trying to detect the motion of a vehicle (from rest) and on reflection, I think this is perhaps best done with locationChanged. I encountered a problem with this method, in that, if the GPS' horizontal accuracy changes while the vehicle is stationary, the "position" returned by locationChanged also changes, making it seem like the vehicle moved, when it didn't. But I guess I can program around that :)

--paul

Post Reply