My app loses connection to Firebase Realtime Database after being put in the background for a while ... In other words when I reopen my app again after being in the background for a while, Realtime Database services stop functioning until I clear the app data at the phone settings and everything back to normal ... I read about similar cases and found out that Android destroys resources (Socket connection) with Firebase after being put in the background for a specific period of time. However, there was no straightforward solution provided to restore connection after going back to the app ... so any help ?