像地理围栏一样使用 geofire

Using geofire like geofences

我想制作一个应用程序,当用户进入某个区域时发送通知。我知道存在 Geofire,我想使用,因为我使用的是 Firebase 数据库,但我从未使用过它,而且我不知道它是否具有与 Google Geofences 相同的行为。

谁能告诉我能否用 Geofire 实现我的想法?

非常感谢您的回答!

如本 post、GeoFire Goes Mobile

中的官方 Firebase 博客所示

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.

回答你的问题,是的,可以用 Geofire 实现你的想法,甚至更多。

GeoFire 是一个客户端库,允许您将地理位置存储在 Firebase 实时数据库中,然后针对该数据触发 GeoQueries 以获取特定点的特定范围内的位置。

它没有对地理围栏的内置支持,但可以使用该库构建地理围栏应用程序。最重要的步骤是:

  1. 您需要定期了解 phone 的位置。
  2. 然后您需要在数据库中查询您所在位置周围的围栏。

我不确定 GeoFire 是否是最合适的可用库(无论如何,推荐技术在 Stack Overflow 上都是题外话)。但似乎可能.