Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit 29ee307

Browse files
authored
Merge pull request #42 from joreilly/master
Add method to update GeoQuery center and radius together atomically. Fixes #39
2 parents 33ce7d1 + 18e4ffe commit 29ee307

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/com/firebase/geofire/GeoQuery.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,4 +411,18 @@ public synchronized void setRadius(double radius) {
411411
this.setupQueries();
412412
}
413413
}
414+
415+
/**
416+
* Sets the center and radius (in kilometers) of this query, and triggers new events if necessary.
417+
* @param center The new center
418+
* @param radius The new radius value of this query in kilometers
419+
*/
420+
public synchronized void setLocation(GeoLocation center, double radius) {
421+
this.center = center;
422+
// convert radius to meters
423+
this.radius = radius * 1000;
424+
if (this.hasListeners()) {
425+
this.setupQueries();
426+
}
427+
}
414428
}

0 commit comments

Comments
 (0)