How to send Firebase Push Notifications with AWS SNS

Firebase cloud messaging (FCM) is a service which enables you to send message or notification on Android device. This session describes how to obtain the FCM prerequisites and send a push notification messages to mobile endpoint. Push notification is sort of message or notification, you can send to users even when they are not actively using your app. Read more about FCM
How push notification works:-
– For push notification, firstly we have to create an app for supported device and messaging API. After registering your app on platform notification service (wills discussion in next step), you will end up with some sort of token or identifier that is unique to each device.
AWS SNS uses these token or identifier to send notification by creating mobile endpoint. Read about AWS SNS.
Points to cover:-

  1. How to create project in FCM
  2.  How to obtain server API key.
  3. Send notification to mobile device


  1. How to create project in FCM
    1. To create FCM project, go to // and click on add project.

      FCM Console
    2. Enter project name and click create project. Once your project is ready click on continue.
    3. How to obtain server API key
      1. Now creating server key, go to setting->Cloud Messaging.
      2. Make note of server key from project credential. If you don’t have server key then click on Add server Key.

        Send notification on mobile device
        For sending notification on mobile device, you first need to register an app with AWS. Registration of application is nothing but creating platform application on AWS SNS.

        1. For creating application platform, go to AWS SNS console and choose Create platform application.

          SNS Dashboard
        2. Enter application name in box and choose GCM application platform.
        3. In API key box, enter appropriate credential and click on create platform application.
      3. After you create platform application, your console looks like this.
      4. When an app and mobile device is register on push notification service, the notification service gives you a device token. This device token is used to create platform endpoint, once you create endpoint you can publish the message to mobile device
      5. To create endpoint, click on create platform endpoint.

        Once you created endpoint, SNS gives us endpoint ARN. Now this is ready to send message to this endpoint. Make sure the device token will change when your app is reinstalled.
      6. For publish message to device, click on publish to endpoint, add message and click on publish message else you can create topic, add endpoint ARN into topic and publish a message to device.


  In this session, we have seen how to send SNS a push notification  by creating project in FCM. You can use other notification service like ADM (Amazon Device Messaging), Baidu etc and send notification to mobile device.


Contributed by :
Akshata Nandimath