imperiumlabs / GeoFirestore-Android

GeoFirestore for Android - Realtime location queries with Firestore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GeoQueryDataEventListener is only calling onGeoQueryReady

csaq7151 opened this issue · comments

commented

HI,
I know there is a solved issue where someone asked why onDocumentEntered is never called, but its not solving my issue.

I called setLocation to add a location to my document

geoFirestore.setLocation(docID, new GeoPoint(37.7853889, -122.4056973), new GeoFirestore.CompletionListener() {
            @Override
            public void onComplete(Exception exception) {
                if (exception == null){
                    Log.d("SUCCESS","Location saved on server successfully!");
                }else
                    Log.e("FAIL","no write     "+exception);
            }
        })

then I call getLocation and I get the correct location- therefor I think the document is ok

geoFirestore.getLocation(docID, new GeoFirestore.LocationCallback() {
            @Override
            public void onComplete(GeoPoint location, Exception exception) {
                if (exception == null && location != null){
                    Log.e("LOC",""+String.format("The location for this document is [%f,%f]", location.getLatitude(), location.getLongitude()));
                }
            }
        });

after that I call the geoQueryDataEventListener to get the document snapshot but the methodes there are not fired.

GeoQuery geoQuery = geoFirestore.queryAtLocation(new GeoPoint(myLatitude, myLongitude), myRadius);

        geoQuery.removeAllListeners();
        geoQuery.addGeoQueryDataEventListener(new GeoQueryDataEventListener() {
            @Override
            public void onDocumentEntered(DocumentSnapshot documentSnapshot, GeoPoint geoPoint) {
                Provider test = documentSnapshot.toObject(Provider.class);
                Log.e("In Range",""+test.getName());
            }

            @Override
            public void onDocumentExited(DocumentSnapshot documentSnapshot) {
                Provider tests = documentSnapshot.toObject(Provider.class);
                Log.e("NOT IN Range",""+tests.getName());
            }

            @Override
            public void onDocumentMoved(DocumentSnapshot documentSnapshot, GeoPoint geoPoint) {

            }

            @Override
            public void onDocumentChanged(DocumentSnapshot documentSnapshot, GeoPoint geoPoint) {
                Provider test = documentSnapshot.toObject(Provider.class);
                Log.e("CHANGED",""+test.getName());
            }

            @Override
            public void onGeoQueryReady() {
                Log.e("Ready","ready");
            }

            @Override
            public void onGeoQueryError(Exception e) {

            }
        });

Can you please help me to fix this?

I have the same problem :/

commented

@marijalukaroska1 I wrote an email to the developers but they are not responding...
I don´t know if we get it working anytime soon.

This problem is still present?