In my Android application, I need to get a list with users from Firestore within a range using GeoFireStore.
Database structure in Firestore:
All the information I got from this link.
Dependency:
implementation 'com.github.imperiumlabs:GeoFirestore-Android:v1.1.1'
Repositories:
maven { url 'https://jitpack.io' }
A code:
CollectionReference geoFirestoreRef =
FirebaseFirestore.getInstance().collection("Users");
GeoFirestore geoFirestore = new GeoFirestore(geoFirestoreRef);
GeoQuery geoQuery = geoFirestore.queryAtLocation(new GeoPoint(32.848971, 35.0920935), 30);
geoQuery.addGeoQueryDataEventListener(new GeoQueryDataEventListener() {
@Override
public void onDocumentEntered(DocumentSnapshot documentSnapshot, GeoPoint location) {
}
@Override
public void onDocumentExited(DocumentSnapshot documentSnapshot) {
}
@Override
public void onDocumentMoved(DocumentSnapshot documentSnapshot, GeoPoint location) {
}
@Override
public void onDocumentChanged(DocumentSnapshot documentSnapshot, GeoPoint location) {
}
@Override
public void onGeoQueryReady() {
}
@Override
public void onGeoQueryError(Exception exception) {
}
});
So I didn't do I can't to call a function:
@Override
public void onDocumentEntered(DocumentSnapshot documentSnapshot, GeoPoint location) {
}
Only this function is called:
@Override
public void onGeoQueryReady() {
}