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 necessary IDs (API key and Sender ID).
  2. Enter the proper IDs (API key and Sender ID) in the Mag+ Publish portal and enable Google Cloud Messaging notifications.
  3. Enter the proper IDs (API key and Sender ID) 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. Login to the Google Developers Console at <https://console.firebase.google.com>.

2. Click "Create New Project."

Click &quot;Create New Project.&quot;

3. Enter your Project name and select your region.

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.

Enter your Project name and select your region.

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

After the project is created, click the settings &quot;gear&quot; icon in the upper-left and select &quot;Project settings&quot;.

5. Click on the "Cloud Messaging" tab.

Click on the &quot;Cloud Messaging&quot; tab.

6. On this page you will find your "Server key" (API key) and "Sender ID".

On this page you will find your &quot;Server key&quot; (API key) and &quot;Sender ID&quot;.

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 copied the Sender ID from the Firebase Console.

1. Login to the Mag+ Publish portal at <https://publish.magplus.com> and go to Apps > Android > Build Settings.

Login to the Mag+ Publish portal at &lt;https://publish.magplus.com&gt; and go to Apps &gt; Android &gt; Build Settings.

2. Under "Google Cloud Messaging," paste the API Key in the appropriate field.

Under &quot;Google Cloud Messaging,&quot; paste the API Key in the appropriate field.

3. Paste the Sender ID into the "Google Cloud Messaging Sender ID" field.

Paste the Sender ID into the &quot;Google Cloud Messaging Sender ID&quot; field.

4. Click the "Enable Notifications" checkbox.

Click the &quot;Enable Notifications&quot; checkbox.

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

Click the &quot;Save&quot; 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 <https://play.google.com/apps/publish/‎> and click on the app that will have messaging enabled.

Log-in to the Google Play Developer Console &lt;https://play.google.com/apps/publish/‎&gt; and click on the app that will have messaging enabled.

2. In the screen that appears, click on the "Services & APIs" link on the left.

In the screen that appears, click on the &quot;Services &amp; APIs&quot; link on the left.

3. On the page that displays, click on the "Link a Sender ID" button.

On the page that displays, click on the &quot;Link a Sender ID&quot; button.

4. In the window that displays, paste the "API Key" into the "FCM API Key" field and click the "Link" button.

In the window that displays, paste the &quot;API Key&quot; into the &quot;FCM API Key&quot; field and click the &quot;Link&quot; button.
Note: If the "Link" button is greyed out you may need to click off of the input field or tab out of it for it to become active.

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

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

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