accelerometer

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
darrychui
Posts: 7
Joined: Mon May 09, 2011 3:01 pm

accelerometer

Post by darrychui » Fri May 27, 2011 10:25 pm

I see there is a tutorial for how to use iphone accelerometer.
Is it the same with the android?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5855
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: accelerometer

Post by jacque » Sat May 28, 2011 11:27 pm

Yes. And it works. :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

darrychui
Posts: 7
Joined: Mon May 09, 2011 3:01 pm

Re: accelerometer

Post by darrychui » Mon May 30, 2011 7:12 pm

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?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5855
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: accelerometer

Post by jacque » Mon May 30, 2011 8:03 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

darrychui
Posts: 7
Joined: Mon May 09, 2011 3:01 pm

Re: accelerometer

Post by darrychui » Mon May 30, 2011 10:34 pm

Can you point me to the location of the android docs referring to the accelerometer?
I am at a lost.
Thank you.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5855
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: accelerometer

Post by jacque » Tue May 31, 2011 3:57 am

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

darrychui
Posts: 7
Joined: Mon May 09, 2011 3:01 pm

Re: accelerometer

Post by darrychui » Tue May 31, 2011 4:44 pm

got it. thx

Post Reply

Return to “Android Deployment”