title: Firebase' true offline capabilities
body: <p>I'm trying to find out how far the offline capabilities of Firebase on Android actually go.</p>
  
  <p>As far as I understand, it should be possible to make the Database "persistent" with <code>FirebaseDatabase.getInstance().setPersistenceEnabled(true);</code></p>
  
  <p>The documentation reads:</p>
  
  <blockquote>
    <p>The Firebase Realtime Database stores data returned from a query for use when offline. For queries constructed while offline, the Firebase Realtime Database continues to work for previously loaded data. If the requested data hasn't loaded, the Firebase Realtime Database loads data from the local cache. When we come back online our data will load and reflect the query.</p>
  </blockquote>
  
  <p>Is this also true when the offline state is beeing forced by <code>goOffline</code>?</p>
  
  <p>In <a href="https://stackoverflow.com/questions/32788751/firebase-sdk-offline-data-storage-with-the-option-to-sync-at-a-later-date">this question</a> the user got an answer from firebase support:</p>
  
  <blockquote>
    <p>While you can use goOffline() to force the client offline for a long time, performance will deteriorate over time. The Firebase clients will queue intermediate state changes, instead of updating the stored state as the server does.</p>
  </blockquote>
  
  <p>Does this mean the "local database" isn't actually updated like it would be when offline due to connection loss? </p>
  
  <p>Because most of the time any query or value event listener doesn't come back, onDataChange is never called as is onCanceled (I checked!)</p>
  
  <p>If only the connection is lost, it actually works as advertised, although sometimes with up to a minute delay, which seems to be a problem on its own.</p>
  
  <p>What is then the intention of even offering the <code>goOffline()</code> method if this just stops the interaction with the database completely?</p>
  
  <p>In my implementation the app starts offline, with an anonymous authentication. So in the beginning of course the "local database" will be completely empty. But shouldn't the value events at least fire onDataChanged with an empty datasnapshot?</p>
  
  <p>I tried staying online until I received the anonymous UID and added an empty entry into firebase database, which then is queried/cached. After that if I call <code>goOffline</code>, no more entries can be added and no more queries will be answered.</p>
  
  <p>Similar to the above mentioned question, my plan is to offer the user the option to stay offline, with of course the downside of the build up of stored write events in the local cache (but that shouldn't be that big of a problem as there isn't that much data)</p>
  
  <p>So how can I make this work if even possible at all?</p>
  
  <p>The only thing I can see is to have some different database solution in the beginning for actual offline capabilities which has to be translated &amp; transferred to firebase when the user chooses to go online.</p>