Reputation: 93
I am working on an Inventory app to run on android. I am planning to use HTML5, JS, pouchdb and couchdb. While I understand that this app after connection to the server, can go offline and work without any connection and sync later, how can I start the app if there is no internet connection?
I tried to use some servers from android play store, but I want to avoid it.
The app should start without any internet connection. Save data locally. Even after quitting, the data should be available and sync when the internet connection becomes available.
Upvotes: 2
Views: 2991
Reputation: 892
Working offline and then syncing data with online servers may be pretty tricky some times.
The most recommended way to do this without impact your UX is wondering some scenarios in which your app will work, like this:
Try to answer the above questions, before designing how your app will start.
This says your user must have an internet connection, when he start your app for the first time.
if this is truly, so your app must start at the first time asking for login or register
After user login, you must store user data retrieved from online servers into a local storage
When the user start the app on the next time, app will recognize it automatically and will skip the login/auth screen.
Your App must follow it normal workflow (creating, editing, deleting inventories)
This answer automatically says that your user data don't needs to be previously registered online, before being modified offline, so no internet needed here, including at the first time the user open the app.
In all of these cases, You're looking for a Progressive Web App, PWA's are web applications which works offline, on the client side.
Upvotes: 4