我尝试使用GeoFireStore来设置、获取和查询位置。
我首先尝试使用以下命令执行setLocation:
geoFirestoreRef = FirebaseFirestore.getInstance().collection("Locations");
geoFirestore = new GeoFirestore(geoFirestoreRef);
geoFirestore.setLocation( auth.getUid(), new GeoPoint(Lat_Coordinate,Lon_Coordinate) );这一切都运行良好,并在我的数据库中创建了以下内容:

现在,我尝试使用以下命令getLocation来查看它是否正常工作:
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。
有什么想法吗?
谢谢
发布于 2020-06-08 19:49:33
我在图书馆也遇到了这个问题。在查看源代码时,我看到了一个小mistake here。
所以我做了一个pull request with the fix。您可以使用fork链接或克隆存储库,并使用以下命令修复第192行:
if (geoPoint != null)https://stackoverflow.com/questions/61665363
复制相似问题