Android - Accelerometer

Community Forums/General Help/Android - Accelerometer

EOF(Posted 2011) [#1]
This is call for help, aimed at any Android dev guys in the house

What I am trying to do is create a class for the Accelerometer which I can later drop into projects without too much effort.
Hopefully this is something which can be used with monkey

The basics will be


Accelerometer accel = new Accelerometer()
// accel.x , accel.y , accel.z


The accelerometer readings will always be accessible by reading the x,y,z values contained within the class


What I have so far crashes horribly (FORCE CLOSE). It seems to be down to either the accelerometer code, or the display setup

Can you guys make sense of this?


TEST CODE




ACCELEROMETER CODE


Last edited 2011


matt!(Posted 2011) [#2]
Have you tried this?

Android - SensorManager
http://blog.androgames.net/85/android-accelerometer-tutorial/

Here are the accelerator functions that may be used for the other supported devices:

iPhone - UIAccelerometer
http://blancer.com/tutorials/i-phone/110706/how-to-make-an-iphone-app-–-part-5-the-accelerometer/

HTML5 - DeviceOrientation
http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5 (example linked to from that page)
http://dev.w3.org/geo/api/spec-source-orientation.html

Flash - flash.sensors.Accelerometer
http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/sensors/Accelerometer.html

XNA - Accelerometer
http://www.jason-mitchell.com/index.php/2009/10/24/zune-hd-accelerometer/

Cheers,
matt


Dabhand(Posted 2011) [#3]
http://blog.androgames.net/85/android-accelerometer-tutorial/

Any good?

Dabz