I would like to implement for a case study, a small app that sends a notification to all users within a certain range of the device. what is the right way to implement it with firebase? I thought of GeoFire and I think we need to constantly update the position. Better to do it with a service? How do I send notifications? someone can enlighten me on the best practices to give me a starting point
Set up a geoFire.queryAtLocation
to be notified of nearby users' movement in and out of area. The query will continue to fire callbacks at you asynchronously; you do not need to issue the query more than once. onKeyEntered
, onKeyExited
and onGeoQueryError
would be events of interest to you.
Use geoQuery.setCenter
repeatedly to update the search criteria to your location, and use geoFire.setLocation
repeatedly to notify all other nearby clients about where you are.