1. Check out our companion app, Forums for Android! Download from Google Play

Detect Movements on Android Device

Discussion in 'Application Development' started by user12, Feb 20, 2012.

  1. user12

    user12 New Member
    Thread Starter
    5

    Jan 28, 2012
    4
    0
    5
    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
    16

    Dec 27, 2011
    58
    5
    16
    Are u talking about gps
     
  3. user12

    user12 New Member
    Thread Starter
    5

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

    jonbonazza Well-Known Member
    163

    Jul 13, 2010
    1,934
    459
    163
    Male
    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
    Thread Starter
    5

    Jan 28, 2012
    4
    0
    5
    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
    163

    Jul 13, 2010
    1,934
    459
    163
    Male
    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...