java – Working with Firebase

Question:

I want to ask a question about Firebase , namely, saving data to a Firebase database. As far as I understand, as soon as the data is stored in the Firebase database, it is immediately sent to the server and Firebase updates the data on all devices that have this application installed. What happens when a user is offline, all data disappears? and the user can no longer use the application? How are conflicts resolved? For example, a user on one device deleted some data while offline, and another user made a change to this data.

Answer:

As soon as the data in FireBase is updated (and if you used the ValueEventListener), then the user who is working in the application at that moment will have an update and he will see it. When the user is offline, all data continues to be stored in Firebase (only the user does not know about this). The user can still use the application even offline, as stated in the documentation . If someone made changes to the database, then the changes will take place immediately, and whoever connects from offline, that is, becomes online, finds the desired branch and already deletes this data. So other users will not see the branch with this data from the database. P.S. what kind of data do you have, that a user can delete it, and another can change it at the same time? It might be better to make them personal – whoever wanted to deleted it, changed it. And make the basic data read-only for the majority.

Scroll to Top