问题
I want to make an app which send a notification when the user enters in an area. I know that exists Geofire, and I would like to use, because i'm using a Firebase database, however I never used it, and I don't know if it has the same behaviour of Google Geofences.
Can someone tell me if I can implement my idea with Geofire?
Thank you very much for your answers!
回答1:
As seen in the oficial Firebase blog in this post, GeoFire Goes Mobile
What is GeoFire?
If you're new to GeoFire, it's a geolocation library that maps string keys to locations and stores them in Firebase. Using GeoFire, you can answer a simple but important question: Which keys lie within a given geographic region? But GeoFire's features don't stop at simple location queries, it's true power is that everything happens in realtime. When objects move, events will be fired as they enter, exit and move around the region.
GeoFire opens a wide range of possibilities: You can build an app that displays who's going for a run within a mile radius of yourself and show their location in realtime. You can display taxis within a search radius and animate them as they move. Or you can build an app that simply lists all interesting bars nearby.
Aswering your question, yes it's possbile to implement your idea with Geofire and even more than that.
回答2:
GeoFire is a client-side library that allows you to store geographic locations in the Firebase Realtime Database, and subsequently fire GeoQueries against that data to get locations within a specific range of a certain point.
It has no built in support for geofencing, but it is possible to build a geofencing app with the library. The most important steps are:
- You need to regularly know the location of the phone.
- You then need to query your database for fences around your location.
I'm not sure if GeoFire is the most suitable library available for this (and recommending technology is off-topic on Stack Overflow anyway). But it does seem possible.
来源:https://stackoverflow.com/questions/47728278/using-geofire-like-geofences