imperiumlabs / GeoFirestore-Android

GeoFirestore for Android - Realtime location queries with Firestore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot set new location

zoro238 opened this issue · comments

When you execute the command to write to Firestore the application collapses.
Note that firebase works perfectly.

geoFirestore.setLocation("k", new GeoPoint(37.7853889, -122.4056973), new GeoFirestore.CompletionListener() {
      @Override
      public void onComplete(Exception e) {
         Log.v("geo","complete"+e);
         // ...
      }
});

Error

02-17 23:36:48.918 31465-31465/com.2.cvcvbb E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.2.cvcvbb, PID: 31465
    java.lang.NoSuchMethodError: No virtual method set(Ljava/util/Map;Lcom/google/firebase/firestore/SetOptions;)Lcom/google/android/gms/tasks/Task; in class Lcom/google/firebase/firestore/DocumentReference; or its super classes (declaration of 'com.google.firebase.firestore.DocumentReference' appears in /data/app/com.2.cvcvbb-2/base.apk:classes2.dex)
        at org.imperiumlabs.geofirestore.GeoFirestore.setLocation(GeoFirestore.java:128)
        at com.2.cvcvbb.MapsActivity.DisplayLocation(MapsActivity.java:195)
        at com.2.cvcvbb.MapsActivity.onConnected(MapsActivity.java:407)
        at com.google.android.gms.common.internal.GmsClientEventManager.onConnectionSuccess(Unknown Source)
        at com.google.android.gms.common.api.internal.zaaw.zab(Unknown Source)
        at com.google.android.gms.common.api.internal.zaak.zaaq(Unknown Source)

its is the same issue as #13

yes but i am used 18.0.1 and same probem

i search slove my problem

I have the same problem.

zoro238, did you solve this mistake?

I have the same problem.

zoro238, did you solve this mistake?

no

@zoro238 what version of GeoFirestore are you using, try the last 1.5.0 and let us know if it solves the problem

it only works this way

geoFirestore.setLocation("k", new GeoPoint(37.7853889, -122.4056973), new GeoFirestore.CompletionListener());

This will work, but no efficient. It will stop the app from crashing. But it will not set the location directly from your app, you will have to set the collection & document name manually and then run your to setLocation & you will get the co-ordinates in your database.

I use it this way CollectionReference mDocRef = FirebaseFirestore.getInstance().collection("mycollection"); GeoFirestore geofire = new GeoFirestore(mDocRef); geofire.setLocation("mystring", new GeoPoint(mLastLocation.getLatitude(), mLastLocation.getLongitude())); am listening to the oncomplete listener but that works well for me.

I use it this way CollectionReference mDocRef = FirebaseFirestore.getInstance().collection("mycollection"); GeoFirestore geofire = new GeoFirestore(mDocRef); geofire.setLocation("mystring", new GeoPoint(mLastLocation.getLatitude(), mLastLocation.getLongitude())); am listening to the oncomplete listener but that works well for me.

Thanks Egesa its working fine now.