I have stored Geofire
coordinates in database and now I\'m trying to retrieve them using childEventListener()
like this:
mDatab
mDatabase.child("geofire").child(key).child("l").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
double latati = 0, longit = 0;
for (DataSnapshot child : dataSnapshot.getChildren()) {
// Log.e("!! All Data ::> ", child.getKey()+" "+child.getValue());
if (child.getKey().equalsIgnoreCase("0")) {
latati = Double.parseDouble(String.valueOf(child.getValue()));
}
if (child.getKey().equalsIgnoreCase("1")) {
longit = Double.parseDouble(String.valueOf(child.getValue()));
}
}
Log.e("!_@@__Lat Long ::", latati + " " + longit);
}
@Override
public void onCancelled(FirebaseError firebaseError) {
Log.e("!!__: ", "onCancelled ", firebaseError.toException());
}
});