blog

Tag Archive for AccelerometerEvent at Jozef Chúťka's blog

December 10, 2010

11 Comments

AccelerometerEvent GeolocationEvent GeomagneticField SensorManager

Geolocation + Accelerometer = Orientation

Coordinate axes drawn over two three-dimensional shapes.

In order to get orientation of your android device you need to do “some” math, based on geolocation and accelerometer values. Working with Android native SDK, you are able to get orientation as easy as calling SensorManager.getOrientation(), but when it comes to AIR SDK, you have no access to the native SDK methods. However, thanks to open sources you are able to grab the original source and rewrite the thing into ActionScript. That is exatcly what I have done. The results are GeomagneticField and SensorManager classes. To make this happen you need both AccelerometerEvent and GeolocationEvent values as intput:

Read the rest of this entry »