So, I have an Android app that lets users view posts within a certain radius of their current location. I am storing the posts using firebase, but I couldn't find a way to query for posts within a specific radius in firebase, so now I am thinking of using geofire, but I am not sure if there is a way to store a location alongside my firebase posts using geofire, so, it would seem to me like the only way to associate a location with a post is to have the post id (the one generated by firebase) be the key for the geofire location. Is this correct or is there a better way?
Associate Geofire location with Firebase entry
Yes, that the correct way. You create a flat DB. One branch with post data and one branch with locations.
© 2022 - 2024 — McMap. All rights reserved.
ref.child("posts").child(postID).addListenerForSingleValueEvent()...
. See firebase.com/docs/android/guide/… – Happiness