Detect Movements on Android Device


Last Updated:

  1. user12

    user12 New Member

    Is it possible to detect whether the android device has moved in a certain direction and how much it has moved? For example, if I move my device 100 pixels to the left, a number would be displayed saying x is -100 pixels. If this is possible, which sensor would I use?

    Advertisement
  2. powerpoint45

    powerpoint45 Well-Known Member

    Are u talking about gps
  3. user12

    user12 New Member

    No, I'm asking if it is possible to detect much smaller movements, like 6 inches or something.
  4. jonbonazza

    jonbonazza Well-Known Member

    You could use the accelerometer i suppose as with any movement, there will be some sort of acceleration and deceleration.
  5. user12

    user12 New Member

    Could you please provide an example? I don't know how to use the acceleration to determine the distance the device moved. Thanks.
  6. jonbonazza

    jonbonazza Well-Known Member

    I honestly don't have much experience with the Accelerometer APIs, so I would be learning just as you would be.

Share This Page