将Geofire位置与Firebase条目相关联 [英] Associate Geofire location with Firebase entry

查看:129
本文介绍了将Geofire位置与Firebase条目相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有一个Android应用程序,允许用户查看他们当前位置的特定半径内的帖子。我正在使用firebase存储帖子,但是我找不到在firebase中查询特定半径内帖子的方法,所以现在我正在考虑使用geofire,但是我不确定是否有办法存储位置除了使用geofire的firebase帖子之外,在我看来,将位置与帖子相关联的唯一方法是将帖子ID(由firebase生成的帖子ID)作为geofire位置的关键字。这是正确的,还是有更好的办法?

你创建一个扁平的数据库。一个分公司的数据和一个分公司的位置


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?

解决方案

Yes, that the correct way. You create a flat DB. One branch with post data and one branch with locations.

这篇关于将Geofire位置与Firebase条目相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆