public class GeoFirestore
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
GeoFirestore.CompletionListener
A listener that can be used to be notified about a successful write or an error on writing.
|
static interface |
GeoFirestore.LocationCallback
A callback that can be used to retrieve a location or an error in retrieving a location.
|
Modifier and Type | Field and Description |
---|---|
static java.util.logging.Logger |
LOGGER |
Constructor and Description |
---|
GeoFirestore(com.google.firebase.firestore.CollectionReference collectionReference)
Creates a new GeoFirestore instance at the given Firestore collection reference.
|
Modifier and Type | Method and Description |
---|---|
com.google.firebase.firestore.CollectionReference |
getCollectionReference() |
void |
getLocation(java.lang.String documentID,
GeoFirestore.LocationCallback callback)
Gets the current location for a document and calls the callback with the current value.
|
static com.google.firebase.firestore.GeoPoint |
getLocationValue(com.google.firebase.firestore.DocumentSnapshot documentSnapshot) |
GeoQuery |
queryAtLocation(com.google.firebase.firestore.GeoPoint center,
double radius)
Returns a new Query object centered at the given location and with the given radius.
|
void |
raiseEvent(java.lang.Runnable r) |
void |
removeLocation(java.lang.String documentID)
Removes the location of a document from this GeoFirestore instance.
|
void |
removeLocation(java.lang.String documentID,
GeoFirestore.CompletionListener completionListener)
Removes the location of a document from this GeoFirestore.
|
void |
setLocation(java.lang.String documentID,
com.google.firebase.firestore.GeoPoint location)
Sets the location of a document.
|
void |
setLocation(java.lang.String documentID,
com.google.firebase.firestore.GeoPoint location,
GeoFirestore.CompletionListener completionListener)
Sets the location of a document.
|
public GeoFirestore(com.google.firebase.firestore.CollectionReference collectionReference)
collectionReference
- The Firestore collection reference this GeoFirestore instance usespublic static com.google.firebase.firestore.GeoPoint getLocationValue(com.google.firebase.firestore.DocumentSnapshot documentSnapshot)
public com.google.firebase.firestore.CollectionReference getCollectionReference()
public void setLocation(java.lang.String documentID, com.google.firebase.firestore.GeoPoint location)
documentID
- The documentID of the document to save the location forlocation
- The location of this documentpublic void setLocation(java.lang.String documentID, com.google.firebase.firestore.GeoPoint location, GeoFirestore.CompletionListener completionListener)
documentID
- The documentID of the document to save the location forlocation
- The location of this documentcompletionListener
- A listener that is called once the location was successfully saved on the server or an
error occurredpublic void removeLocation(java.lang.String documentID)
documentID
- The documentID of the document to remove from this GeoFirestore instancepublic void removeLocation(java.lang.String documentID, GeoFirestore.CompletionListener completionListener)
documentID
- The documentID of the document to remove from this GeoFirestorecompletionListener
- A completion listener that is called once the location is successfully removed
from the server or an error occurredpublic void getLocation(java.lang.String documentID, GeoFirestore.LocationCallback callback)
documentID
- The documentID of the document whose location to getcallback
- The callback that is called once the location is retrievedpublic GeoQuery queryAtLocation(com.google.firebase.firestore.GeoPoint center, double radius)
center
- The center of the queryradius
- The radius of the query, in kilometers. The maximum radius that is
supported is about 8587km. If a radius bigger than this is passed we'll cap it.public void raiseEvent(java.lang.Runnable r)