Firebase Cloud Messaging
Firebase Cloud Messaging (FCM) is a cross-platform messaging solution which reliably sends the message at no cost. It is formally known as Google Cloud Messaging, which is used for Android, iOS, and web applications.
The service is provided by Google's subsidiary Firebase and on 21 October 2014, Firebase announced that it had been acquired by Google for an undisclosed amount. The official Google Cloud Messaging website demonstrates the Firebase Cloud Messaging (FCM) as the new version of GCM.
If we are using Google Cloud Messaging (GCM) server and client APIs, then there is some bad news, which is that this service has already been removed, and Google plans to discontinue "most" GCM services in April 2019. If we are still using GCM, then we should start migrating our projects to FCM now and complete our migration by April 2019.
FCM is a free, cross-platform messaging solution which allows us to send push notifications to our audience without worrying about the server code. Using FCM with Firebase's Notification Composer (as seen in the following screenshot), the user can create notifications that target very specific sections of the user base, generally without writing any specific code. Using FCM:
How is FCM differ from GCM?
How does it work?
FCM implementation contains two main components for sending and receiving. The first one is a trusted environment such as Cloud Function for Firebase or an app server on which to build, target, and send messages, essentially the server-side, and another one is an android client app which receives messages. If we implement our own server code in Cloud Function or Java code, then we can send messages via Firebase Admin SDK or the FCM server protocols.
We can also use the Notification composer for testing or for sending marketing or engagement messages with powerful built-in targeting and analytics.
1) Set up the FCM SDK
Set up Firebase and FCM on our app according to the setup instruction for our platform.
2) Develop our client app
In our client app, we have to add message handling, topic subscription logic, or other optional features. During development, we can easily send text messages from the Notification composer.
3) Develop our app server
We need to decide whether we want to use the Firebase Admin SDK or one of the server protocols to create our sending logic, i.e., logic to authenticate, buildsend requests, handle responses, etc., and build out the logic in our trusted environment.
4) Concerning the development of our own app server
It will give us the basics of the Server environment, but we will not write any code.