【发布时间】:2019-05-28 22:21:43
【问题描述】:
我目前正在为我的基于位置的 Android 应用程序规划我的数据库(未来某个时候的 iOS 应用程序的愿景)。
我想知道以下结构是否适合我的需要。快速了解我的应用程序所涉及的内容:在 2 公里半径(地理围栏)内找到用户并显示他们的个人资料(类似于在 Tinder 上与某人匹配)。
所以我的设想是每个用户通过谷歌地图 API 将他们的LatLon 位置上传到我的数据库 - 并且 Android 会查询数据库以在地理围栏内找到用户。
PS:在地理围栏内查询用户的最佳方式是什么?
我建议的数据库是Google Firestore,文档设置如下:
users: {
2394824972439 (facebook_id): {
gender: "male"
currentLat: 37.234234,
currentLon: 157.192835,
profileImg1: googlecloudstorage.com/url/to/img1.png,
profileImg2: googlecloudstorage.com/url/to/img2.png,
bio: "This is my bio",
alreadyMatchedWith: [42304823423, 23423423432, 023948230]
}
7388824972439: {
gender: "female"
currentLat: 34.234234,
currentLon: 157.132835,
profileImg1: googlecloudstorage.com/url/to/img1.png,
profileImg2: googlecloudstorage.com/url/to/img2.png,
bio: "Another bio",
alreadyMatchedWith: [82304823423, 33423423432, 923948230]
}
}
因此,查询还将确保其他用户的 facebook ID(我使用 facebook 登录)尚未匹配。如果尚未匹配,则数据库将返回该用户的文档并显示他们的个人资料信息以及来自谷歌云的个人资料图片。贮存。
我应该关注此设置是否有任何危险信号 - 或任何更好的替代方案?
【问题讨论】:
标签: android google-maps