1

I am working on an Android app that checks if two users are geographically nearby each other (getting the distance between the two co-ordinates in meters, to be precise). While this question correctly answers how to do that, I am more interested in possibility of calculating the distance without actually using the co-ordinates.

Why? The calculation will be done on server-side. I don't want to pass the user's location details to my server since that can amount to privacy concerns.

One way I could think of achieving this was by determining the distance between the user's current location and an arbitrary point and then passing this distance to the server. But I am not sure how accurate that would be.

Is this possible? How?

Community
  • 1
  • 1
kapeels
  • 1,692
  • 4
  • 30
  • 52
  • 1
    Why would your app in particular have privacy concerns with sending the user's coordinates to the server? Tons of applications on the user's phone are probably sending these coords all the time? – Rich Nov 05 '13 at 05:46
  • @Rich: Making the user's location visible to others (even indirectly) is quite a bit more invasive than the more familiar location-based services, like navigation and local search. Finding the nearest gas station: great! Getting an unwelcome visit from your ex, who figured out where you were based on your friends' locations in some stupid app..not so great! If only more app developers were so concerned about leaking location data... – Jim Lewis Nov 05 '13 at 07:11
  • @JimLewis How is my activity on Yelp or any other app that sends my location in plain text to their servers going to get me an unwelcomed visit from a person in the real world? – Rich Nov 05 '13 at 18:29
  • @Rich: The leak is that the app reports the distance between you and another user. So a potential stalker could see "Jim Lewis is 1 mile away" and draw a 1-mile circle around their current position. Drive to somewhere on the circle, now see "Jim Lewis is .75 miles away", draw another circle...notice they intersect near that restaurant I like...proceed to bust in and ruin my dinner with new girlfriend. So I would hope that such an app would dither my uploaded positions a bit (or the distances reported) to make it more difficult to figure out my true location. – Jim Lewis Nov 05 '13 at 19:24
  • 1
    "proceed to bust in and ruin my dinner with new girlfriend", Turn off location services or close such apps, this helps more! – AlexWien Nov 05 '13 at 19:34
  • @JimLewis OP was asking about how to calculate these things thereby discussing how the data should be sent and received on the wire. What you display in your app is entirely up to you. If you don't want to be busted in on, don't use an app that DISPLAYS where you are or your relative distance. I use app like Zillow, Yelp and Urbanspoon on a daily basis...these apps use my GPS coords in their api calls to return data to me, and this does not leak my location to any other users. I'm almost positive that's what OP is asking. – Rich Nov 05 '13 at 23:11

1 Answers1

0

The more accurately you report the distances between users, the more information you leak about each user's location. Any three users could, in theory, combine their observations and triangulate a fourth user's position to within the tolerance of the individual measurements.

You could add a random longitude+latitude offset every time a user's location is uploaded, or add some noise to the reported distances. That would obscure each user's location, depending on how much noise was added.

If you're going to collect this information at all, I hope you'll make that clear in the license agreement that users' locations will be recorded to a resolution of meters and disclosed to others!

Jim Lewis
  • 43,505
  • 7
  • 82
  • 96
  • I am not really saving the location data anywhere. It's just compared on the fly and then discarded. – kapeels Nov 05 '13 at 10:22