private boolean isAccelerating(SensorEvent event){
  float ax=event.values[0];
  float ay=event.values[1];
  float az=event.values[2];
  final double magnitude=Math.sqrt(ax * ax + ay * ay + az * az);
  return magnitude > ACCELERATION_THRESHOLD;
}

private boolean isAccelerating ( SensorEvent event ) { float ax = event . values [ 0 ] ; float ay = event . values [ 1 ] ; float az = event . values [ 2 ] ; final double magnitude = Math . sqrt ( ax * ax + ay * ay + az * az ) ; return magnitude > ACCELERATION_THRESHOLD ; }
returns true if the device is currently accelerating .
