firebase / geofire-java

GeoFire for Java - Realtime location queries with Firebase
MIT License
670 stars 271 forks source link

Geofire query doesn't work in android #163

Open kishanverma26 opened 4 years ago

kishanverma26 commented 4 years ago

here is my code addGeoQueryDataEventListener method not calling

private fun allvendors() {

        var vendorList:JSONObject
        vendorArray= JSONArray()
        var ref_vendore = FirebaseDatabase.getInstance(firebase_driver_url).getReference("location_vendor").child("1")
        var geoFire_vendore = GeoFire(ref_vendore)
        val geoQuery =  geoFire_vendore?.queryAtLocation(GeoLocation(picklat, picklng), radius_driver)!!
        loggg("geoquery",geoQuery.toString())
        geoQuery.addGeoQueryDataEventListener(object :GeoQueryDataEventListener{
            override fun onGeoQueryReady() {
                Log.e("erropr","geoquery ready")
            }

            override fun onDataExited(dataSnapshot: DataSnapshot?) {
                Log.e("erropr",dataSnapshot.toString())
            }

            override fun onDataChanged(dataSnapshot: DataSnapshot?, location: GeoLocation?) {
                Log.e("erropr",dataSnapshot.toString())
            }

            override fun onDataEntered(dataSnapshot: DataSnapshot?, location: GeoLocation?) {
                vendorArray.put(dataSnapshot?.key?.replace("vendor",""))
                loggg("vendor list","$vendorArray")
            }

            override fun onDataMoved(dataSnapshot: DataSnapshot?, location: GeoLocation?) {
                Log.e("erropr",dataSnapshot.toString())
            }

            override fun onGeoQueryError(error: DatabaseError?) {
                Log.e("erropr",error.toString())
            }

        })
    }`
samtstern commented 4 years ago

@kishanverma26 saying that it "doesn't work" is not enough information to help debug. What is happening, what do you expect to happen, do you see any errors, are you sure your data is correct, etc?