I would like to detect if a user is moving by using an android smartphone - walking or jumping doesn't matter - want to know if the user wearing the smartphone is moving.
I have found this code example
private final SensorEventListener sensorEventListener = new SensorEventListener() {
double calibration = SensorManager.STANDARD_GRAVITY;
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
public void onSensorChanged(SensorEvent event) {
double x = event.values[0];
double y = event.values[1];
double z = event.values[2];
double a = Math.round(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)
+ Math.pow(z, 2)));
currentAcceleration = Math.abs((float) (a - calibration));
basically the squarerootof the three axis, which are raised to power 2 = sqrt(x-axis^2 + y-axis^2 + z-axis^2) = G force
And it gives readings between 0.01 and 0.2 G's - does anyone know how to translate these readings into "movement" - is it even possible this way - by use of G force