Hi there (especially Frank)
I'm trying to find out how removed the standalone features of Firebase on Android are.
As far as I understand, it should be possible to make the database persistent with FirebaseDatabase.getInstance().setPersistenceEnabled(true);
The documentation reads:
The Firebase Realtime database stores data returned from the request for offline use. For queries created offline, the Firebase Realtime database continues to work for previously downloaded data. If the requested data is not loaded, the Firebase Realtime database downloads data from the local cache. When we return online, our data will load and reflect the request.
Is this also true when the offline state is enforced using goOffline ?
In this question, the user received an answer from firebase support:
While you can use goOffline () to force disconnect the client offline, performance will degrade over time. Firebase clients will post interim state changes instead of updating the saved state, as the server does.
Does this mean that the "local database" is not actually updated, as if it had been disconnected due to loss of connection?
Since in most cases none of the event or value listeners is returned, onDataChange is never called as onCanceled (I checked!)
If only the connection is lost, it actually works as advertised, although sometimes with a delay of up to a minute, which, apparently, is a problem on its own.
What is the intention to offer the goOffline() method if it just completely stops interacting with the database?
In my implementation, the application runs offline with anonymous authentication. Therefore, at the beginning of the course, the "local database" will be completely empty. But shouldn't the event values at least trigger onDataChanged with an empty datasnapshot?
I tried to stay online until I received an anonymous UID, and added an empty entry to the firebase database, which is then queried / cached. After that, if I call goOffline , no more entries can be added and no more requests will be received.
As in the question mentioned above, my plan is to offer the user the opportunity to stay offline, of course, the disadvantage of escalating saved record events in the local cache (but this should not be a big problem, because there is not much data)
So how can I do this work, even if at all possible?
The only thing I see is first to have some other database solution for real autonomous capabilities, which needs to be transferred and transferred to firebase when the user decides to go online.