Firebase Mobile Connection Testing Issues For Android
I'm building an app using Firebase Realtime Database and I'm testing out the onFailure callback. I turn off my mobile data and run the code below. mDatabaseReference.updateChildren
Solution 1:
The onFailure
callback only triggers when the write is fails on the server, typically because it is rejected by your security rules.
Not having a network connection does not trigger a failure, it merely delays the write to the database server until you're back online again.
Also see:
- Firebase database for Android - write events when offline, using persistence
- Firebase offline no CompletionListener on setValue
- Firebase database query not returning when offline (on how to detect whether you have a connection)
Solution 2:
You can use the thread in order to check if a connection is available, since firebase does not provide methods to check that: How to check currently internet connection is available or not in android
Post a Comment for "Firebase Mobile Connection Testing Issues For Android"