1

I linked firebase realtime database with my app and added login with email. I want to be able to see other users that are nearby(about 1 km). My original idea was to get my own location based on latitude and longitude and send it to firebase. Then when I log in I would scan all user's location and compare it to mine to show only those around me. It seems to me like a very bad idea to do it this way. My concerns are I would need to scan a lot of users and having all their location data in the app seems like a high security issue. I need a better way to do this. Any suggestions please?

Saul
  • 91
  • 2
  • 14
  • What you're describing is typically done with GeoFire, an add on library that uses geohashes to allow querying for items in a range around a certain location. See https://stackoverflow.com/questions/43357990/query-for-nearby-locations – Frank van Puffelen Jul 23 '20 at 13:36

1 Answers1

0

Maybe store each person location in "chunks" that are about 2km x 2km in size.

When a client need to see other users nearby, send him the location of users in his chunk + adjacents chunks and let the client do the final math to determine if they are in the 1km radius.

To avoid security issues, limit the number of chunks a client can request per minute/hour/day.