Search code examples
androidsensorsandroid-sensors

How to detect whether user move the android phone or not?


Is there any way to detect whether user move the device or not ? I want to do something when the device moved and do other thing when the device stopped.


Solution

  • Yes you can. Te best place to learn abou it is on Android documentation.

    From android doc:

    Most Android-powered devices have built-in sensors that measure motion, orientation, and various environmental conditions. These sensors are capable of providing raw data with high precision and accuracy, and are useful if you want to monitor three-dimensional device movement or positioning, or you want to monitor changes in the ambient environment near a device.