title: How to sync offline database with Firebase when device is online?
body: <p>I'm currently using angularJS and phonegap to build a test application for Android / iOS.</p>
  
  <p>The app use only text data stored in a Firebase database. I want the app to have its own local database (used when the device is offline) and sometime (when the device is online)
  sync with a Firebase database.</p>
  
  <p>The offline mode uses the storage API of phonegap/cordova. Could I just check the device's online state and backup the online database periodically ?</p>
  
  <p>Any clues on how I can achieve this ? Last time a similar question was asked, the answer was "not yet"... <a href="https://stackoverflow.com/questions/14670394/does-firebase-allow-an-app-to-start-in-offline-mode">(here)</a>... because it focused on a hypothetical Firebase feature.</p>