Using the accelerometer and other sensors
The Accelerometer records the device acceleration in three dimensions, that is, along the x, y, and z axis. Almost all phones are now shipped with an accelerometer as it's a pretty old technology. Indeed, the very first phone to have one was the Apollo 11 Lunar Module. A phone with wheels. Actually, the first mainstream and terrestrial phone equipped with this technology was the Samsung SCH-S310 in 2005 on which you could dial numbers by writing them in the air. Today's application of the accelerometer are almost all related to games. In this recipe, we will detect if the phone is falling; this can be useful for the elderly in the sense that we can be warned of emergencies automatically.