You are viewing Skygear v1 Documentation.Switch to Skygear v0 Documentation

Setting up FCM for Android Push Notification

You can send Push Notification to your user's devices via Skygear Push API or CMS Push Manager. Skygear uses the Firebase Cloud Messaging(FCM) service to send push messages to client Android applications.

To enable sending Push Notifications through FCM, you need:

Overview of Skygear Push Notifications

Setup Firebase Project

In the dashboard of Firebase Console, click on Create New project.

Create a new Firebase project

After creating a project, go to Project Settings.

Go to project Settings of your project

Obtain server credential from Google Firebase Console

There are TWO ways setting up FCM:

  1. Use service account (Firebase Admin SDK)
  2. Use server key (FCM legacy HTTP API)

Using service account is available in Skygear Server v1.7.0 or later. We recommend using service account approach which use the updated HTTP v1 API.

Option 1: Using Service Account (v1.7.0 onward)

1. Download the service account private key

In the Service accounts tab, click Generate new private key to download the service account private key JSON file.

Download service account private key for Firebase Admin SDK

2. Upload the service account private key at the Skygear Portal

Go to Skygear Portal at App > Push Notification > Firebase Cloud Messaging (FCM), turn ON Enable Firebase Cloud Messaging and turn OFF Use Legacy FCM Server API. Upload the service account file and click Save Changes.

Upload service account file in Skygear Portal

3. Enable the Firebase Cloud Message API in your Google project

It is enabled by default for newly created project. You may need to enable it manually for some existing project. To check it go to Google Console.

Option 2: Use Server Key (All version)

In the Cloud Messaging tab, you will find your server keys in place.

Find your server Keys in the Cloud Messaging tab

You can copy existing or create new Server Keys under the Project credentials section.

Filling in the Server Key in Skygear Portal

Go to Skygear Portal at App > Push Notification > Firebase Cloud Messaging (FCM), turn ON Enable Firebase Cloud Messaging and turn ON Use Legacy FCM Server API. Paste the server key and click Save Changes.

Fill in the Server in Skygear Portal