首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GeoFireStore getLocation返回null

GeoFireStore getLocation返回null
EN

Stack Overflow用户
提问于 2020-05-08 02:42:42
回答 1查看 110关注 0票数 1

我尝试使用GeoFireStore来设置、获取和查询位置。

我首先尝试使用以下命令执行setLocation:

代码语言:javascript
复制
geoFirestoreRef = FirebaseFirestore.getInstance().collection("Locations");
geoFirestore = new GeoFirestore(geoFirestoreRef);

geoFirestore.setLocation( auth.getUid(), new GeoPoint(Lat_Coordinate,Lon_Coordinate) );

这一切都运行良好,并在我的数据库中创建了以下内容:

现在,我尝试使用以下命令getLocation来查看它是否正常工作:

代码语言:javascript
复制
geoFirestore.getLocation( auth.getUid(), new GeoFirestore.LocationCallback() {
    @Override
    public void onComplete(GeoPoint geoPoint, Exception e) {
        Log.d("ERROR", "Error getting documents: "  + e);

    }
} );

由于某些原因,它无法获取任何信息,甚至无法在我的数据库中看到这个位置。

我得到了一个例外:java.lang.NullPointerException: Location doesn't exist

有什么想法吗?

谢谢

EN

回答 1

Stack Overflow用户

发布于 2020-06-08 19:49:33

我在图书馆也遇到了这个问题。在查看源代码时,我看到了一个小mistake here

所以我做了一个pull request with the fix。您可以使用fork链接或克隆存储库,并使用以下命令修复第192行:

代码语言:javascript
复制
if (geoPoint != null)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61665363

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档