4

Using Android Studio, what sort of things are needed when trying to compare a specific user's location to every other user. For example if there are 1000 simultaneous users, and I want to find the closest one(or farthest) to any given user, what sort of calculations need to be done?

If each user's locations were saved to a DB, where do I start? Is it necessary to compare one location against the 1000 (or more) users to find the closest, or would it make more sense to make some type of cut-off (i.e. only compare users who are within 50km).

It seems overwhelming and I am new to android, so I am unsure where to even start. Parse.com and Pubnub are being used in this project.

Blaasd
  • 315
  • 3
  • 16
  • I had this same challenge back in 1995 with MapInfo software trying to closest known medical provider locations to a given insurance member's location. I built a 3 dimensional array to handle the results for quick look up later but the algorithm for finding distances is quite straight forward and probably just requires looping through all of the known geo-locations with the user's current geo. See this SO post for details: http://stackoverflow.com/questions/13840516/how-to-find-my-distance-to-a-known-location-in-javascript – Craig Conover Nov 30 '15 at 22:32

1 Answers1

2

Geohashing by User Proximity Tutorial

I'll reference for you here the geohashing tutorial that walks you through how to build a realtime app that connects users based on relative location. Note that this example is written in JavaScript and not Java/Android. However you can still use this design pattern to determine proximity.

App Geo Location: https://www.pubnub.com/blog/2014-05-07-geohashing-chat-by-proximity/

There is also a short video which discusses the Geohasing concept.

Comparing a Location with Multiple Users

Adding in Parse SDK and Location Comparison

Also you can add in this link: Parse reference guide. And a Parse Connector SDK if needed.

Community
  • 1
  • 1
Stephen Blum
  • 6,498
  • 2
  • 34
  • 46