Here is the goal:
A farmer has a smartphone and goes into his barn to take inventory with the app. Sometimes his phone does not get internet connection in the barn, so the app needs to work offline, store data offline, and then sync it to the cloud once it is reconnected.
The farmer should also have to only login and register the app once, and then each time they open the app, it should just open to the home screen and not ask for login info ever again. How exactly could this be done?
I am using Meteor to make the app, and Meteor's built in Cordova to package the app. I have seen GroundDB: https://github.com/GroundMeteor/db
As far as I can tell in the docs, I know how to create a local collection and use collection.insert to add data to that collection.
But I am lost as to how to code the app to open on the phone without needing internet, and detecting if internet is present or not?
Then how do I detect if internet has come back, and then sync all the data stored in offline mode?
If someone can help lay out how this would work that would be greatly appreciated!