How we can add user online/offline system with firebase or other…?
issue is that when user suddenly turn off mobile data/wifi then firebase can’t get store value of user offline…any idea?
If i understand this correctly.U want to prevent from storing data offline, and letting the user store it when he/she is online, correct me if i’m wrong
i think this block would be helpful:
Also you can make something your self like
if network1.isConnected{
store value;
} else{
set temp value to the value you want to store;
}
And in the event network1.On Connect
if not is empty temp value {
store value (temp value)
set temp value to (empty string);
This code will allow your data to be stored when the user be connected again.If you simply don’t want the data to be stored when user get his connection back, just :
add this if-then statement:
if is connected{
storeValue;
}
Store Timestamp (millis) in database every second.
So others can compare time they were last online
If time difference is less than 3-5 seconds, then they are online.
i can’t understand…any example thanks if if with aia
When user online then value save as online in firebase…but how i can change it into offline when user offline?
Do your users write a lot of data all the time? If they don’t record, you can, before trying to record online, check if there is a connection, if there is a connection record online if there is no connection record offline in Sqlite.