Detect Movements on Android Device


Last Updated:

  1. user12

    user12 New Member This Topic's Starter

    Joined:
    Jan 28, 2012
    Messages:
    4
    Likes Received:
    0
    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

    Joined:
    Dec 27, 2011
    Messages:
    58
    Likes Received:
    5
    Are u talking about gps
     
  3. user12

    user12 New Member This Topic's Starter

    Joined:
    Jan 28, 2012
    Messages:
    4
    Likes Received:
    0
    No, I'm asking if it is possible to detect much smaller movements, like 6 inches or something.
     
  4. jonbonazza

    jonbonazza Well-Known Member

    Joined:
    Jul 13, 2010
    Messages:
    1,934
    Likes Received:
    458
    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 This Topic's Starter

    Joined:
    Jan 28, 2012
    Messages:
    4
    Likes Received:
    0
    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

    Joined:
    Jul 13, 2010
    Messages:
    1,934
    Likes Received:
    458
    I honestly don't have much experience with the Accelerometer APIs, so I would be learning just as you would be.
     

Share This Page

Loading...