Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Take A QuizChallenge yourself and boost your learning! Start the quiz now to earn credits.
Take A QuizUnlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Take A QuizKindly log in to use this feature. We’ll take you to the login page automatically.
LoginGeneral Tech Bugs & Fixes 3 years ago
User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.
If you really must make your application unusable when the user's device even temporarily loses its connectivity, you will have to add a listener to a special location called /.info/connected. It will tell you when the SDK thinks it has lost its connected. This is described in the documentation. You will have to write code to make your app behave the way you want when your listener is notified like this.
However, your application may have still written data in the time it took from the moment the connection to became stalled, before the SDK makes a decision that the connection is actually gone. And those writes will still be synchronized.
It's better to just make your application usable offline, and notify the user when their data isn't yet synchronized due to being offline.
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Kindly log in to use this feature. We’ll take you to the login page automatically.
LoginReady to take your education and career to the next level? Register today and join our growing community of learners and professionals.
Your experience on this site will be improved by allowing cookies. Read Cookie Policy
Your experience on this site will be improved by allowing cookies. Read Cookie Policy
manpreet
Best Answer
3 years ago
Currently, in order to prevent write to Firebase after returning back from offline, I check for internet connectivity before every write operation. And by that I do not mean just checking for network connectivity, but also if there is actual internet access available. I ping google.com in order to find out.
I do not think this is the best way to do that.
So, what is the best practice to just tell Firebase not to cache any write operations when there is no internet connection available and just preview a plain simple "No internet connection available" message?