Skip to content Skip to sidebar Skip to footer

How To Receive A Notification To Android User, When Ever Firebase Database Is Updated?

I have an android application connected with firebase. When ever a new child is added to the database I need the user to be notified via a notification message. Moreover, in my app

Solution 1:

if your server side is firebase ,to send notification when child added , you need to create a firebase cloud function which will do that so this what you will do :

  • create firebase cloud function
  • send data with notification ( using payload )
  • after receiving data in your service ( Messaging listner )check if the data ( number ) is equal to some of saved numbers in shared preferences

Solution 2:

On firebase, we got callbacks to provide realtime database functionalities.

Ways of doing so:

  • Register a onChildAdded listener to the firebase node URL and it get triggered whenever a child is added and you can run a service that could cause notification payload which run on client side.
  • use Firebase cloud functions which run on service side.

Solution 3:

Once i developed such application, in order to achieve this i used broadcastreceiver which was monitoring my data base for new information. (It is just suggestion) But u can still make use of this tutorial

Post a Comment for "How To Receive A Notification To Android User, When Ever Firebase Database Is Updated?"