diff --git a/common/src/main/java/com/firebase/geofire/GeoFire.java b/common/src/main/java/com/firebase/geofire/GeoFire.java index 1d0f20f..28e0177 100644 --- a/common/src/main/java/com/firebase/geofire/GeoFire.java +++ b/common/src/main/java/com/firebase/geofire/GeoFire.java @@ -28,17 +28,20 @@ package com.firebase.geofire; +import static com.firebase.geofire.util.GeoUtils.capRadius; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + import com.firebase.geofire.core.GeoHash; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; -import com.google.firebase.database.ValueEventListener; import com.google.firebase.database.GenericTypeIndicator; -import java.lang.Throwable; -import java.util.*; -import java.util.logging.Logger; - -import static com.firebase.geofire.util.GeoUtils.capRadius; +import com.google.firebase.database.ValueEventListener; /** * A GeoFire instance is used to store geo location data in Firebase. @@ -172,14 +175,14 @@ public void setLocation(final String key, final GeoLocation location, final Comp updates.put("g", geoHash.getGeoHashString()); updates.put("l", Arrays.asList(location.latitude, location.longitude)); if (completionListener != null) { - keyRef.setValue(updates, geoHash.getGeoHashString(), new DatabaseReference.CompletionListener() { + keyRef.updateChildren(updates, new DatabaseReference.CompletionListener() { @Override public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) { completionListener.onComplete(key, databaseError); } }); } else { - keyRef.setValue(updates, geoHash.getGeoHashString()); + keyRef.updateChildrenAsync(updates); } } @@ -212,7 +215,7 @@ public void onComplete(DatabaseError databaseError, DatabaseReference databaseRe } }); } else { - keyRef.setValue(null); + keyRef.setValueAsync(null); } }