1. Download our Official Android App: Forums for Android!

Apps Detect Movements on Android Device

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

  1. user12

    user12 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Jan 28, 2012

    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 Member
    Rank:
    None
    Points:
    16
    Posts:
    58
    Joined:
    Dec 27, 2011

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

    user12 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Jan 28, 2012

    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 Android Expert
    Rank:
    None
    Points:
    163
    Posts:
    1,930
    Joined:
    Jul 13, 2010

    Jul 13, 2010
    1,930
    457
    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 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    4
    Joined:
    Jan 28, 2012

    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 Android Expert
    Rank:
    None
    Points:
    163
    Posts:
    1,930
    Joined:
    Jul 13, 2010

    Jul 13, 2010
    1,930
    457
    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...