I am working recently on an android chat application based on Firebase realtime database and using Offline data persistance.

The problem I'm facing is that when I first open the app, it takes some time to get data from firebase database, so when i open a conversation, if the network is slow it takes sometime to show messages and sometimes it can go to few seconds or more of blank chat conversation!!

I had enabled offline persistance and when there is no network everything is showing up correctly and quickly, but when there is a network connexion it takes some time and it's what I don't want to because when we say Chat we say realtime without latency!

I was thinking about adding all my firebase database data into sqlite and show it from local db at the first time!

Is there any way to make my app shows always offline data and when firebase connexion works fine synchronize the data? if not, how about using sqlite? and how to keep my data synchronized?

0 Answers