Home » Push Notification » Send Push Notification from Firebase

Send Push Notification from Firebase

Here I have explained how to send a push notification to the android app through Firebase Console. For sending push notifications we have to configure the android app in the Firebase console and need to set up the server-side SDK.

Before setup the configuration first let me explain how it works overall from Firebase and server-side briefly. Here is the process which involves sending a push notification.

  1. Configure Android App in Firebase Console.
  2. Add Firebase SDK to sever.

Once we finished the above two setups successfully then we start to send the push notification to the installed users of the configured android app. Let me explain how it works.

Every user will get a unique device token after installed the android app successfully. This device token will be saved in the Firebase server and we also need to save it in our database.

You all think that why we need to save the device token in the database because we are going to send the notification to the device tokens only from the Firebase SDK which is configured on the server-side.

Whenever we are pushing the notifications to the device tokens from the server-side, Firebase receives that and sends it to all the device tokens. which means the users who all are installed the app will be getting the notification.

Let me explain in detail how this push notification goes from server to Firebase and Firebase to installed users of the app.

The architecture of sending Push Notification

What you have to do is first you have to create a Rest API on your server-side to receive the device token from the android app. Android App passes the device token with your API whenever the app launches.

Then you have to store that in your database with some reference like a user id or reference key of the user's account. So based on this reference key you can save your device token or update the token if already exist.

Now you can send the push notifications to the list of device tokens whichever you want from Firebase SDK. There are many methods available in the SDK for sending push notifications.

Firebase provides SDK in many languages like Java, .Net, Python, Node.js, and Go SDK. So you can use whichever is suitable for your development. If you want to know the Firebase SDK setup then please take a look at their documentation here.

I have configured Java SDK on the server-side for sending push notifications. If you want to know that please take a look at Configure Firebase Java SDK.

The below architecture diagram shows the process of sending push notifications from sever side SDK to Firebase console.

firebase

I hope you will be getting an overall process of sending push notifications. If you need any concerns please keep me updated.

Here I explained the overall process. If you want to know in detail please go through the links below.

  1. Configure Android App in Firebase Console.

2. Add Firebase SDK to server

Leave a Reply

Your email address will not be published. Required fields are marked *