android - detect downward acceleration, specifically an elevator
问题 I want to be able to detect a situation where the phone has an acceleration towards the ground (probably means that the Gravity sensor has to be used here also). I have read a lot about this topic in the Android docs, about High and Low pass filters and other posts, and right now what I have is a code sample that gets the acceleration in the X, Y and Z axis after stripping the gravity: if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { final float alpha = (float) 0.8; gravity[0] =