java – How to connect to firebase database when android device is restarted


so I have what may be a simple problem. I want to connect to my firebase database and listen for any changes so I can show a notification to the user, like for example, you reboot your phone and do not have to open an app, but you can still receive notifications from the app like when a chat comes in. I tried the boot completed receiver but it didn’t really work, and I can’t seem to get the network change receiver to work when the device is restarted. I have the code to access my database and show notifications. I just need a way to invoke the service that accesses the database and shows notification regardless of whether the device was rebooted or not.
I am using java.
Thanks a lot

Tried boot completed receiver, didn’t work, guess due to android changes from Android 8 or 10.
Tried network connection receiver, didn’t work when device is rebooted



Source link

Leave a Comment