android - Can't retrieve data from a Firebase's node -


i'm developing android app , i'm using firebase database. want specific node i'm failing retrieve these data.

i've written firebase's security rules , data structure:

enter image description here

this android code:

public void connect() {     //setting connexion parameter     final firebase ref = new firebase("https://test.firebaseio.com/test");     query query = ref.orderbychild("longitude").equalto("150");       //get data th db     query.addlistenerforsinglevalueevent(new valueeventlistener() {          @override         public void ondatachange(datasnapshot datasnapshot) {             //checking if user exist             if(datasnapshot.exists())                 (datasnapshot usersnapshot : datasnapshot.getchildren()) {                     //get each user has target username                     final location location = usersnapshot.getvalue(location.class);                      //if password true , data storaged in sharedpreferences file , home activity launched                      system.out.println("hello map"+location.getlongitude());                  }                  system.out.println("not found");         }          @override         public void oncancelled(firebaseerror firebaseerror) {             system.out.println("problem ");          }     });   } 

and location class

public class location { private string  longitude,latitude; public string getlongitude() {     return longitude; }  public void setlongitude(string  longitude) {     this.longitude = longitude; }  public string getlatitude() {     return latitude; }  public void setlatitude(string latitude) {     this.latitude = latitude; }  @override public string tostring() {     return "location{" +             "longitude=" + longitude +             ", latitude=" + latitude +             '}'; }  public location(string longitude, string latitude) {     this.longitude = longitude;     this.latitude = latitude; } 

}


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -