Page 1 of 1

accelerometer

Posted: Fri May 27, 2011 10:25 pm
by darrychui
I see there is a tutorial for how to use iphone accelerometer.
Is it the same with the android?

Re: accelerometer

Posted: Sat May 28, 2011 11:27 pm
by jacque
Yes. And it works. :)

Re: accelerometer

Posted: Mon May 30, 2011 7:12 pm
by darrychui
Hmmm...
Did you have to use a accelerometer simulator like the lesson suggest?
The example use the udp port to get the data from the simulator.
If you don't want to use the simulator, which callback method do I use to get the data?

Re: accelerometer

Posted: Mon May 30, 2011 8:03 pm
by jacque
Sorry, I had a thinko -- I was thinking of motion events, which I use and which work. I haven't tried the accelerometer, but the docs say it works identically. The Android emulator is very basic, so if I were you I'd try testing on a real device. From the Android docs:
Enabling the accelerometer will cause accelerationChanged events to be delivered to the current
card of the defaultStack at a frequent interval.
The accelerationChanged message takes a single parameter pSample, which consists of four values:
x,y,z,t
Here x, y and z are the acceleration along those axes relative to gravity. The t value is a relative measurement of how much time has passed – you can use the difference between the time values in two accelerationChanged events to give an indication of how much time passed between the samples.

Re: accelerometer

Posted: Mon May 30, 2011 10:34 pm
by darrychui
Can you point me to the location of the android docs referring to the accelerometer?
I am at a lost.
Thank you.

Re: accelerometer

Posted: Tue May 31, 2011 3:57 am
by jacque
Sure. You need version 4.6.1. The Android release notes are under LiveCode's Help menu, which opens the PDF doc. The iOS release notes are there too.

Re: accelerometer

Posted: Tue May 31, 2011 4:44 pm
by darrychui
got it. thx