I am not sure if that is what firebase is supposed to do, but when I use this line:
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
Everything is great I can use the app offline. But what I am hoping to achieve is that, when a user adds something in offline and closes the app. And when the network connection restores user doesn't have to open the app again, it should sync itself without opening the app. Is it possible?