Now in my app, if I have persistence disk enabled... if I setvalue while offline and close app, the value sets only when I reopen it. But I want to set it when internet connection recovers. Any solution? I use firebase for android studio with java.
CodePudding user response:
You cannot keep your app always in sync with the Firebase servers, while the app is in the background because the Android OS will eventually close it in favor of other apps.
When you enable offline persistence, it means your app writes the data locally to the device so you can continue to work with it while offline, or even if the user or operating system restarts the app.
If you want to perform some actions while the app is in the background, you should consider using a service.