NATIVE ANDROID | FIREBASE CLOUD MESSAGING | FIREBASE

Share the post

HOW TO IMPLEMENT FIREBASE CLOUD MESSAGING IN ANDROID ?

Hello All,
Today we will discuss about firebase cloud messaging (FCM) service offered by google. Basically, FCM is nothing but advance version of google cloud messaging  (GCM). In this topic we will see What is Firebase Cloud Messaging (FCM) ? How to implement firebase cloud messaging in android application ? What are the benefits to have a firebase cloud messaging ?

What is Firebase Cloud Messaging (FCM) ?

FCM is the service offered by google. It’s basically sending message in terms of notification from google server to any device which is currently using your android application. For that your device must have to registered with google server after that google can identify it by using registration key assign to your device & then finally google server can communicate with our device which contains the android application.

How to implement Firebase Cloud Messaging to our android application ?

To implement FCM in our app we don’t need to add multiple files or don’t have to write some code. You just need to add one dependency to your application app.gradle file as shown in below image :
gradle_dependency
 after adding the dependency you have to create a project to google firebase console. I’m considering that you have the basic knowledge to create a application in google firebase console. After creating a project in google firebase console follow the below 6 steps to send notification to our device.

1. Click on cloud messaging menu from left side as shown in below image :

step1
after that click on send your first message button as shown in above image.

2. Write basic notification details:

step2
Write the notification title & message which we want to send. You can able to see how the notification will look like as shown in above image.

3. Write the target details :

step3

Now, this is the most important step. You have to select target user that means you have to select your android application package name which you want to target to show the notification. On clicking of that dropdown you will able to find your package name , after find your package click on it & select it.

4. Write scheduling details :

step4
You can able to select date & time on which you have to publish the notification or simply select Now to send on current date & time.

5. Click on Review as shown in below image :

step5

6. Final step to send a notification :

step6
After click on review you will get one popup containing short description about the notification. Just go through it, review it & click on Publish button. If your device is connected to internet & application is installed on it then you can able to see the notification on it.

What are the benefits by using Firebase Cloud Messaging ?

  • It’s easy to integrate with any android application.
  • It’s offered by google
  • Fast service
  • To send notification for android users like any offer details, discounts etc.
  • To send chat message. You can able to to chat application using FCM.

Leave a Comment