Geolocation + Accelerometer = Orientation

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 »