I'll be building a very simple data collection system, the collection part will be running on some kind of small tablet, not determined yet probably an Android. My concern is that in some sites, where this collection is going to take place, it may not be internet connection, because is inside a warehouse with metal walls.
Is anyone dealt with such scenario before?
I was thinking in building an app that runs on Android that synchronize with the main database via API calls, when finds a connection.
The way that will be the best, but i don't know if possible, would be to have a local server that runs the web app with sqlite as a holding database.
Any suggestions?
@dan3460 Your approach is exactly right. You’ll need to hold data in local storage (I’m not too au fait with Android) and then sync with the service as soon as the app has a connection again.
I did something similar for an EPOS system, but built using Electron rather than native apps. If records were created on the client, they’d be given a UUID and put into local storage. A service worker would then detect when a network connection was available again and then play the updates against the server in API calls. UUIDs were used to avoid primary keys clashing or getting out-of-sync (i.e. if some records were created on the server before the client synced its records).
There is the potential for conflicts (i.e. if an existing record is updated on the client, and the server before the client syncs). Unfortunately, this will be more up to you how you deal with that as that’s business logic.
Thanks for the answer. We need to devices to be cheap, falls and running over by a forklift are guaranteed, reason why i'm pointing to Android.
Now, for the most part this devices will have access to the web, so they will be connected all the time to the main Laravel app. Does anyone knows if is there something that could cache the connection so it seems that you still connected to the web?
Does anyone knows if is there something that could cache the connection so it seems that you still connected to the web?
@dan3460 That makes no sense. If the device doesn’t have a network connection, then it doesn’t have a network connection. You literally can’t send data if there’s no bandwidth to do so.
You’ll need to set up some activity in your Android app that sends updates to your Laravel app and if there’s no connection, queues them up somewhere and then sends them once the device gets a connection again.