How to store data when user is offline

You always Need internet to communicate with airtable. i think this not possible.

but you can store user data in TinyDB and Send/Update on Airtable when Internet is Connected.
Means you can Postpone Update.

1 Like

Yes, that is my question. How can I know when the user goes offline in my admin app?

1 Like

Yeah, I tried that, but it doesn’t make any sense because the value in the database will still be “online” and when he goes online (when internet is connected) then it should show “online” and if I called value from TinyDB then it will store “offline” which is false.

Does anyone have a solution for this? I am making a chatting app and I want to show last seen if he disconnected from the internet or closed the app. I can use “On App Stop” event if he closed the app, but if he disconnected from the internet then also it should show offline in a database. But it won’t get stored if there is no connection.

there is one DIY way to find user is online or offline but very critical.

User 1 App have to send particular value(to check user is online) User 2 App at every 5sec. and if you got responce from User 2 App then set User is online Else Offline.

For that you have to set value When Particular value Got then Post Online Value. else Offline.

And also you have to change Topic title. “mention How to show User is Online/Offline.” in topic title

2 Likes

Its simple , so simple
send timestamp from user one every 2 second(it dont take that much data)
and when time stamp gets old by one minute means user get offline,so set last seen as that timestamp
now if you want to show in second user app then just add these i said above
it will say online if timestamp is not old by one minute (or you decide like 10second) else it will show last seen as timestamp

2 Likes

Yes, the logic is nice, but if we don’t get any response from User 2 then how will it store the data as “offline”? If we do not get any response then it means the user has no internet connection and so the data will not be stored.

Yes brother I can check it without any problem but the value will not get stored in database as “offline” without having internet.

but other application can check

Yes, but only if the other user sends him a message. Or else it won’t work. I want to send value instantly in airtable as “offline” if he disconnects from the internet.

no when other person will open his profile then he will automatically see
else you have to get a bot to do this

So if user 1 disconnects from internet then the value in the database will still be “online” until user 2 opens the app.

yes it will be ,i dont know there is any other solution
you need a bot or server for that

1 Like

you can only implement on app close , not on internet off, because on disconnect it cant do anything to airtable

2 Likes

Yes, I know. How do Android studio developers manage it? What logic do they use? There must be an another way to do this :thinking:

1 Like

there is a snippet for it they dont manage

1 Like

There Should be One User Online

Same thing like this

3 Likes

Please someone help me… I’m still stuck on this problem. I want to store data in airtable as “Offline” when user gets disconnected from internet connection and I’m using “onDisconnect” to store data as “Offline” but it is not storing data because it is an event which gets triggered when there is no internet. Is there any other solution?

i think you must use a clock and for every 5 second store user time to airtable, and when user goes offline, you will know that what last time was ?

1 Like

I don’t want to see last seen, I just want to know whether the user is online or offline in airtable. And I don’t need a Clock component to check internet every 5 seconds because there is already “On Connect” and “On Disconnect” event available but it doesn’t get stored when the user disconnects from the internet. That is the problem.

1 Like