The android service
solution described in https://www.codementor.io/sundayakinsete/firebase-real-time-notifications-app-to-app-opkwbo6ba has serious limitations:
- it doesn't work when the application is not running (remember that when the user puts your app in background the system could decide to terminate it to free device memory)
- it uses extra battery, RAM and network data, to keep the service actively listening for remote database changes
- each device with the app running, even in background, would count towards the limit of 100,000 simultaneous connections to the database.
- it does not work on iOS
on the other side, if you use Firebase Cloud Messaging (via Cloud Functions or a custom server):
- you can receive notifications even if the app is closed
- you don't consume extra battery or cpu
- you can use the database limit of 100,000 simultaneous connections for the users that are actually using the app in foreground.
- it works on iOS and Web