I am using Firebase Firestore and I'm facing a problem with the read operation: I use an onCompleteListener, and inside there, I call different callbacks if the operation was successfull or not. The problem is, if there is a network issue, the onCompleteListener is called, but task.isSuccessfull returns true!! So I get an empty result which I can't distinguish from a REAL empty result. Is there any way to distinguish a network issue from an empty read?
Thank you very much! My function is just below:
dataBase.collection(COLLECTION)
.whereEqualTo(FIELD, searched)
.get()
.addOnCompleteListener { task: Task<QuerySnapshot> ->
if (task.isSuccessful) {
listenerSuccess(task.result)
} else {
listenerError()
}
}