There has been a few discussions about it, but there is still not a good solution. Simple problem - recognize when the device is laying somewhere not moving (in relation to earth) and when is moving. Accelerometer seems to be a good sensor to use.
First suprise came to me, when I logged data from the sensor events. When the device (htc hero) is laying on the table - the values are changing! sth. like -0.7, -0.7, 10.1 -0.6, -0.8, 10.0 and so on - fluctuating I haven't expected that, but let's go on - I thought I woudl compute the real force, and went with private double computeRealForce(SensorEvent event) { return Math.sqrt(Math.pow(event.values[0], 2) + Math.pow(event.values[1], 2) + Math.pow(event.values[2], 2)) - SensorManager.GRAVITY_EARTH; } very similiar approach as seen in http://github.com/commonsguy/cw-advandroid/blob/master/Sensor/Shaker/src/com/commonsware/android/sensor/Shaker.java and similiar in http://www.anddev.org/example_detecting_-und-quotshake-und-quot_with_the_accelerometer-t4451.html and the computed value also fluctuates, 0,35 0,39 0,4 but I can apply force treshold like 0,5 as a kind of filter and everything is ok. But when I put my phone to stand vertically - suddenly my computed force turned out to be -1,01 -1,05 I give up - I don't know what is the good enough solution - the one that would give around zero value when the device isn't moving in relation to earth - is there any? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en