I am making a taxi app and I use Geofire and Geoquery to get nearest drivers.
Now I have 3 types of cars "3 seats, 4 seats and 7 seats" and the user can switch between them, I want to change the query to get data from the correct reference.
My Code for reference and query:
refDrivers = FirebaseDatabase.getInstance().getReference("drivers_locations_" + car_seats + "seat");
geoFireDrivers = new GeoFire(refDrivers);
geoQuery = geoFireDrivers.queryAtLocation(new GeoLocation(31.2551039, 30.0162619), 3);
where car_seats is the chosen car type by the user.
To change the reference, you have to create a new instance of
GeoFireand then query it again, just make sure to remove the listeners to theGeoQuerybefore attaching new listener.There's no method to change the reference on the fly.