AIR on mobile enables you to access the accelerometer of the mobile device. But what about the motion sensor in your macbook / macbook pro computer on the desktop? All macbooks come with a “sudden motion sensor”, which shuts down the hard disk when the laptop moves too much.
I wrote an AIR native extension, to access this sensor information in AIR on OSX. I tried to mimic the Accelerometer API as much as possible, and make it easy to use in your AIR application.
You can check if the SuddenMotionSensor is supported on your mac, set the update interval and listen for accelerometer events:
1 2 3 4 5 6
You can then access the accelerometer info in the event handler:
1 2 3 4