You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Firestore does not generate any callback/exception on attempting to upload data when device is offline. Hence, I am not able to alert the user to check their internet connection and retry.
Neither the onCompleteListener, nor the OnFailureListener callbacks get triggered.
@AayushTaneja that's actually expected behavior. Those listeners only fire when the write has actually been written to the backend (or failed to do so). So when offline, they just never fire.
However when you write it's immediately written to the offline cache. So if you attach a snapshot listener to the location you're writing, you can get confirmation of the offline write that way (you'll get a DocumentSnapshot with the pending changes indicator set to true).
I have the same issue as @Zedonboy but when reading some data, not writing. How are we supposed to distinguish lack of connection vs real empty result received from server?
Step 1: Are you in the right place?
Step 2: Describe your environment
Step 3: Describe the problem:
Firestore does not generate any callback/exception on attempting to upload data when device is offline. Hence, I am not able to alert the user to check their internet connection and retry.
Neither the onCompleteListener, nor the OnFailureListener callbacks get triggered.
Steps to reproduce:
Write code to upload data to firestore:
FirebaseFirestore.getInstance().collection("users").document("abcd").set(user).addOnCompleteListener(...).addOnFailureListener(...);
Run the app and turn off the internet connection.
Observed Results:
No callback/exception thrown
Expected Results:
onFailure callback or onComplete callback should be triggered and throw error or exception.
The text was updated successfully, but these errors were encountered: