Android - Enabling Google Cloud Messaging (Firebase) in Your Android Apps

Google Cloud Messaging, now called Firebase (FCM), allows you to send messages to users who have installed your app. This article will walk you through the process of enabling Firebase, entering the proper IDs in the mag+ Publish portal, and then linking the service to your Android app.

Before You Begin

You should have at least one app created in the Google Play Developer Console. For more information, read the article "Android - Creating an App in the Google Play Developer Console."

Important Information

Firebase only works for apps that are uploaded to the Google Play Developer Console. If you are building an internally-facing enterprise app (ie. one that will not be made available to the public at large) you must use a workaround to be able to send push notifications to users of your app.

The workaround is to upload your enterprise app to the Google Play Developer Console as an Alpha or Beta test app. As long as the app is not published, users of the Google Play Store will not see it, and you will be able to send push notifications to your internally distributed app.

How to Enable Google Cloud Messaging in Your Android App

This procedure is broken down into three parts:

  1. Enable Firebase for your app and generate the API key and .json file.
  2. Enter the API key and .json file in the mag+ Publish portal and enable notifications via FCM.
  3. Enter the API key in the Google Play Developer Console to link them to your app.

How to Enable Google Cloud Messaging (Firebase) in the Google Developers Console

1. Go to console.firebase.google.com and login to your account.

2. Click on “Add Project”.

3. Enter your Project name, select your region and click on “Create Project”.

The "Project name" can be anything you want to name it, we recommend naming it something similar to your app's name to make it easily identifiable for later if necessary.

4. After the project is created, click the settings "gear" icon in the upper-left and select "Project settings".

5. Under Project settings, click on “Add Firebase to your Android app”.

6. Fill the Android package name, nickname (optional) and click on “Register app”.

Note: This package name should be similar to the one used in the mag+ publish portal

7. Download .json file and click Next. Similarly, click Next on the next step and skip the last step to complete the process.

8. On the screen that appears, Click the "Cloud Messaging" tab.

9. On this page, you will find your "Server key" (API key)

How to Configure and Enable Google Cloud Messaging (Firebase) in the mag+ Publish Portal

Before You Begin

  • Make sure you have copied the Server key (API key) from the Firebase Console.
  • Make sure you have downloaded the .json file from the Firebase Console.

1. Login to the mag+ Publish portal and go to Apps > Android > Build Settings.

2. Under "Google Cloud Messaging," click the “enable notifications via FCM” checkbox, paste the API Key in the appropriate field, and upload the .json file.

3. Click the "Save" button at the bottom of the page.

Click the "Save" button at the bottom of the page.

How to Configure and Enable Google Cloud Messaging (Firebase) in the Google Play Developer Console

Before You Begin

1. Log-in to the Google Play Developer Console and click on the app that will have messaging enabled.

4. You should now see a message saying that the Sender ID has been successfully linked and see it appear under "LINKED SENDER IDS".

Congratulations! You have now successfully enabled Google Cloud Messaging (Firebase) and linked it to your Android app.

Whether this is your first app submission or your app is already live in Google Play, a new .apk file must be generated and uploaded to Google Play to include Google Cloud Messaging in your app.

Note: If you are updating your existing app, be sure to update your build version number before generating a new .apk as mentioned in step 2 of our Android - Updating a Live App article.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk