|
28 | 28 |
|
29 | 29 | package com.firebase.geofire;
|
30 | 30 |
|
| 31 | +import static com.firebase.geofire.util.GeoUtils.capRadius; |
| 32 | + |
| 33 | +import java.util.Arrays; |
| 34 | +import java.util.HashMap; |
| 35 | +import java.util.List; |
| 36 | +import java.util.Map; |
| 37 | +import java.util.logging.Logger; |
| 38 | + |
31 | 39 | import com.firebase.geofire.core.GeoHash;
|
32 | 40 | import com.google.firebase.database.DataSnapshot;
|
33 | 41 | import com.google.firebase.database.DatabaseError;
|
34 | 42 | import com.google.firebase.database.DatabaseReference;
|
35 |
| -import com.google.firebase.database.ValueEventListener; |
36 | 43 | import com.google.firebase.database.GenericTypeIndicator;
|
37 |
| -import java.lang.Throwable; |
38 |
| -import java.util.*; |
39 |
| -import java.util.logging.Logger; |
40 |
| - |
41 |
| -import static com.firebase.geofire.util.GeoUtils.capRadius; |
| 44 | +import com.google.firebase.database.ValueEventListener; |
42 | 45 |
|
43 | 46 | /**
|
44 | 47 | * 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
|
172 | 175 | updates.put("g", geoHash.getGeoHashString());
|
173 | 176 | updates.put("l", Arrays.asList(location.latitude, location.longitude));
|
174 | 177 | if (completionListener != null) {
|
175 |
| - keyRef.setValue(updates, geoHash.getGeoHashString(), new DatabaseReference.CompletionListener() { |
| 178 | + keyRef.updateChildren(updates, new DatabaseReference.CompletionListener() { |
176 | 179 | @Override
|
177 | 180 | public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
|
178 | 181 | completionListener.onComplete(key, databaseError);
|
179 | 182 | }
|
180 | 183 | });
|
181 | 184 | } else {
|
182 |
| - keyRef.setValue(updates, geoHash.getGeoHashString()); |
| 185 | + keyRef.updateChildrenAsync(updates); |
183 | 186 | }
|
184 | 187 | }
|
185 | 188 |
|
@@ -212,7 +215,7 @@ public void onComplete(DatabaseError databaseError, DatabaseReference databaseRe
|
212 | 215 | }
|
213 | 216 | });
|
214 | 217 | } else {
|
215 |
| - keyRef.setValue(null); |
| 218 | + keyRef.setValueAsync(null); |
216 | 219 | }
|
217 | 220 | }
|
218 | 221 |
|
|
0 commit comments