Air 2.0 Accelerometer component for MacBooks

Yes, it is now possible to build all these cool stuff with Air 2.0 & MacBook.

MacBooks have a device called SMS ( Sudden Motion Sensor ) which can act as our Accelerometer. And using Air 2.0’s NativeProcess, we can invoke a native program to give us the Accelerometer data. Here is how the flow goes:

I got a simple C-Program called “motion” (bundled in the below package) which can give me X,Y & Z co-ordinates of Accelerometer & print on the console. I execute the process using NativeProcess API & capture the console output.

I made a wrapper class called “MBAcceleromoter” to make this entire process easier.

You are right. That is the case for devices which have accelerometer support. But, Macbook does not have Accelerometer in it. That is why this post uses a round about way of using “Sudden Motion Sensors (SMS)” as Accelerometer. If the device actually had a Accelerometer, you could directly use the new inbuilt Accelerometer APIs provided by Air 2.0.

Device with Accelerometer & Air 2.0 are the only two requirements for using inbuilt Accelerometer APIs. But, you need to have a MacBook & Mac OS running Air 2.0 for the current SMS based example to work.

Hi there, I'm Srinivas Annam, a Tech Savvy living in Bangalore, India. I'm a RIA lover in general and I like Flash, Flex, AIR & UI designing in particular. I'm working as Lead Software Engineer in Flex development team at Adobe, Bangalore.