title: How do I detect an offline Meteor Cordova app, and then use GroundDB to temp store data until back online?
body: <p>Here is the goal:</p>
  
  <p>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. </p>
  
  <p>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?</p>
  
  <p>I am using Meteor to make the app, and Meteor's built in Cordova to package the app. I have seen GroundDB: <a href="https://github.com/GroundMeteor/db" rel="noreferrer">https://github.com/GroundMeteor/db</a></p>
  
  <p>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. </p>
  
  <p>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? </p>
  
  <p>Then how do I detect if internet has come back, and then sync all the data stored in offline mode? </p>
  
  <p>If someone can help lay out how this would work that would be greatly appreciated! </p>