Hello All, Today we will discuss the firebase cloud messaging (FCM) service offered by Google. Basically, FCM is nothing but an advanced 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 applications? What are the benefits to have a firebase cloud messaging?
HOW TO IMPLEMENT FIREBASE CLOUD MESSAGING IN ANDROID ?
What is Firebase Cloud Messaging (FCM) ?
FCM is the service offered by Google. It’s basically sending messages in terms of notification from the google server to any device which is currently using your android application. For that, Your device must have to be registered with a Google server after that google can identify it by using the 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 the below image :
after adding the dependency you have to create a project to the google firebase console. I’m considering that you have the basic knowledge to create an application in the google firebase console. After creating a project in the google firebase console follow the below 6 steps to send notifications to our device.
1. Click on cloud messaging menu from left side as shown in below image :
after that click on send your first message button as shown in the above image.
2. Write basic notification details:
Write the notification title & message which we want to send. You can able to see how the notification will look like as shown in the above image.
3. Write the target details :
Now, this is the most important step. You have to select the target user that means you have to select your android application package name which you want to target to show the notification. On clicking that dropdown you will be able to find your package name, after finding your package click on it & select it.
4. Write scheduling details :
You can able to select the date & time on which you have to publish the notification or simply select Now to send on the current date & time.
5. Click on Review as shown in below image :
6. Final step to send a notification :
After clicking on review, You will get one popup containing a short description of the notification. Just go through it, review it & click on Publish button. If your device is connected to the internet & the 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.