How to calculate distance between two droids?

Discussion in 'Android Hacks and Help' started by Chrispyk, Mar 24, 2011.

  1. Chrispyk
    Offline

    Chrispyk New Member

    Joined:
    Mar 24, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Well, let's kill two birds with one thread. I'm new here, and I'm looking to develop a Droid game. I can code it, but I'd like to see if there's some easier way than what I have planned now.

    My game needs to know the relative distance between multiple droid phones and one central droid phone (all running my game). I have two theories on how that might be achieved.
    1: require a particular GPS program be installed on each phone, and use that data to calculate the distance, or
    2: Have one phone put out a signal of some sort, and have other phones use the amplitude of the signal to determine how close they are.

    Is anyone familiar enough with this stuff to recommend a solution, or shall I blaze a trail? Thanks in advance!
  2. Skull One
    Offline

    Skull One New Member

    Joined:
    Mar 11, 2010
    Messages:
    760
    Likes Received:
    6
    Trophy Points:
    0
    First you need to define: What is the granularity of distances you want to measure. IE feet, yards, miles?

    Your 1st idea is useless because your app can talk directly to the GPS of the phone without needing to have an extra program.

    Your 2nd idea is unworkable under more conditions than I care to list.
  3. Chrispyk
    Offline

    Chrispyk New Member

    Joined:
    Mar 24, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Ideally, I'd like to have it return feet, but yards is workable. I can't use a margin bigger than that, though.

    And sorry about my lack of knowledge on the Droid's capabilities, that's why I'm here.
  4. Snow02
    Offline

    Snow02 New Member

    Joined:
    Jan 12, 2011
    Messages:
    1,342
    Likes Received:
    9
    Trophy Points:
    0
  5. Skull One
    Offline

    Skull One New Member

    Joined:
    Mar 11, 2010
    Messages:
    760
    Likes Received:
    6
    Trophy Points:
    0
    Ok feet it is.

    Does your app have to work indoors?

    How many feet can it be off and not render the data useless?


    EDIT:
    And Snow02 found the link I was looking for.
  6. Chrispyk
    Offline

    Chrispyk New Member

    Joined:
    Mar 24, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    It's all for outdoors (if they go indoors, they lose). And it can be off by no more than 2-3 yards and still be accurate enough for my purposes. Obviously, less than that is better, but I know battery life can be an issue.
  7. Chrispyk
    Offline

    Chrispyk New Member

    Joined:
    Mar 24, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    And that link is incredibly helpful, btw. Many thanks, Snow02.
  8. Snow02
    Offline

    Snow02 New Member

    Joined:
    Jan 12, 2011
    Messages:
    1,342
    Likes Received:
    9
    Trophy Points:
    0
    No problem. That's the go-to site for any android app development questions. For the most part, it does a great job of walking you through implementing specific features. Best of luck.

    And you might want to check out the game Home Invasion. It sounds very similar to what you're working on.
  9. Skull One
    Offline

    Skull One New Member

    Joined:
    Mar 11, 2010
    Messages:
    760
    Likes Received:
    6
    Trophy Points:
    0
    Excellent, so you can use true GPS to determine position instead of cell tower data.

    If memory serves, been a while since I played with the live data, you need 4 sats to get a 3D fix on your location. But the float error can be as large as 900 feet. 5 sats can get you down into the 150 feet float error area. 6 sats can get you down into the 30 foot. 7 sats can get you down to 15 feet. But if you do averaging of the data over time you can actually reduce this issue greatly.

    Buildings higher than 10 feet could screw with your accuracy if the sat is low on the horizon.

    There is also the issue of drift, that can screw up your positioning data. WAAS is used to correct that and I am unsure if the Android OS has access to that data.
Search tags for this page
app distance between two phones
,
calculate distance between 2 phones
,
calculating the distance between two cell phone
,
can i use gps to determine the distance between mobile phones
,
compute distance between two mobile phones
,

distance between two android phones

,

distance between two phones

,
how to find distance two android mobiles
,
masure distance by two android phone
,

measure distance between two phones

,
measure distance between two phones app
,
proximity between two phones