我想填充我的回收者视图,以便我可以看到附近的人/地方是谁.我使用GeoFire查询我的数据库,看起来像这样.
GeoQuery geoQuery = geoFire.queryAtLocation(new GeoLocation(latLngCenter.latitude, latLngCenter.longitude), 0.1);
geoQuery.addGeoQueryEventListener(new GeoQueryEventListener() {
@Override
public void onKeyEntered(String key, GeoLocation location) {
System.out.println(String.format("Key %s entered the search area at [%f,%f]", key, location.latitude, location.longitude));
Log.e("TAG", key + location.latitude + location.longitude);
}
@Override
public void onKeyExited(String key) {
System.out.println(String.format("Key %s is no longer in the search area", key));
}
@Override
public void onKeyMoved(String key, GeoLocation location) {
System.out.println(String.format("Key %s moved within the search area to [%f,%f]", key, location.latitude, location.longitude));
Log.e("TAG", key + location.latitude + location.longitude); …
Run Code Online (Sandbox Code Playgroud) android firebase geofire firebase-realtime-database firebaseui