Firebase send notification upon changes in real time database

前端 未结 1 1546
清酒与你
清酒与你 2021-02-03 12:01

I found two possible approaches to deliver notifications after some changes in the Firebase real time database (for example in a chat application):

相关标签:
1条回答
  • 2021-02-03 12:12

    The android service solution described in https://www.codementor.io/sundayakinsete/firebase-real-time-notifications-app-to-app-opkwbo6ba has serious limitations:

    1. 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)
    2. it uses extra battery, RAM and network data, to keep the service actively listening for remote database changes
    3. each device with the app running, even in background, would count towards the limit of 100,000 simultaneous connections to the database.
    4. it does not work on iOS

    on the other side, if you use Firebase Cloud Messaging (via Cloud Functions or a custom server):

    1. you can receive notifications even if the app is closed
    2. you don't consume extra battery or cpu
    3. you can use the database limit of 100,000 simultaneous connections for the users that are actually using the app in foreground.
    4. it works on iOS and Web
    0 讨论(0)
提交回复
热议问题