imperiumlabs / GeoFirestore-Android

GeoFirestore for Android - Realtime location queries with Firestore

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What if the searched area is empty?

quebin31 opened this issue · comments

I can't handle the case whenever the search area is empty, or maybe I'm not seeing it, it's like there is a missing onEmptyResult or something like that.

You should collect all your data in onDocumentEntered callback into some collection, until onGeoQueryReady is called.
`var isGeoQueryReady = false
val initialDocumentSnapshots = mutableListOf()'

'override fun onGeoQueryReady() {
isGeoQueryReady = true
//check if initialDocumentSnapshots is empty
}'

'override fun onDocumentEntered(p0: DocumentSnapshot, p1: GeoPoint?) {
if (isGeoQueryReady) {
...
} else {
initialDocumentSnapshots.add(p0)
}
}`

Closing because it's solved by the documentation