I have a very simple question. I have implemented push notifications many many times in apps, specially Android. But I am still curious to know, that how do these notifications library like, OneSignal or FCM actually check, if there is a new notification ?
What I think - They might be using some kind of listeners and checking for a new notification after a certain interval of time.
I would really love to read your answer...
If simplified:
Android System (Google Play Services) establishes a socket connection to FCM server. This connection is kept alive always.
Once there is some message on the FCM server, it writes it's details to the socket. The data is transmitted to the device, and Google Play Services receive this data.
After that Google Play Services sends the data to the target application, who's FCM service is called and the notification data is passed to.