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:
- Install Skygear Android SDK on your app. Learn how to install SDK if you haven't.
- Setup credentials for FCM in Skygear Portal
Setup Firebase Project
In the dashboard of Firebase Console, click on Create New project.
After creating a project, go to Project Settings.
Obtain server credential from Google Firebase Console
There are TWO ways setting up FCM:
- Use service account (Firebase Admin SDK)
- 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.
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.
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.
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.