Getting an API key to use with Google Cloud Messaging

AndroidGoogle Cloud-Messaging

Android Problem Overview


I am developing an Android app and I'd like to start testing out push notifications. From a code perspective, I'm all set. My current challenge is that I simply do not know how to get a Google Cloud Messaging API key from Google.

There are loads and loads of tutorials and videos online showing how this can be done in about 10 seconds but Google has recently updated it's developer center and none of the tutorials seem to apply any more. The current process seems very cumbersome and not at all similar to what I've seen online.

I realize that this barely passes as a programming question (if at all) but there is no way that I'm going to even begin to be able to develop anything without an API key from Google.

Is someone able to point me in the right direction?

Android Solutions


Solution 1 - Android

CommonsWare was right about three years ago (2013). This is a revision to his answer.

Note: Even if you have already enabled any services and have API keys this will still work.

  1. Log in to Google Services with your google account. (This is not the same as the Google Console)

  2. Click on Pick a Platform

  3. Click on Enable services for Android

  4. Fill out the app name and package name

  5. Select Cloud Messaging. (Or any other service you want. You can come back to this later and add more)

  6. Click on Generate Configuration Files

  7. Boom. Right there on top in the Cloud Messaging card under Server API key

  8. Also, you will want to download the google-services.json file and copy it to the app/ or mobile/ module directory in your Android project

Solution 2 - Android

> but Google has recently updated it's developer center and none of the tutorials seem to apply any more

:: sigh ::

That's yet more work for my next book update...

> The current process seems very cumbersome and not at all similar to what I've seen online.

Bearing in mind that I am already set up with keys, and therefore may be seeing somewhat different stuff than would somebody with no keys:

Step #1: Log into https://cloud.google.com/console with your Google account

Step #2: In the navigation on the left, go into "APIs & auth > APIs"

Step #3: Find "Google Cloud Messaging for Android" and click the "OFF" button next to it (note: this might involve then agreeing to additional terms of service)

Step #4: In the navigation on the left, go into "APIs & auth > Registered apps"

Step #5: Wait a really long time, apparently.

Step #6: Click the red REGISTER APP button.

Step #7: Give the app a name and choose Web Application, then click Register

Step #8: Click the "Server Key" section for your server key

Solution 3 - Android

Google has updated their api console recently to Google Cloud Console. In short terms , you need to create an Android application and pick Accessing APIs via a web server. this service has a detailed guide for that

Solution 4 - Android

The easiest way to configure GCM API key and Sender ID, is to Google login with your account and continue the Wizard : https://developers.google.com/mobile/add :)

Solution 5 - Android

To get FCM (Firebase cloud messaging) key for a web app

  1. login into Firebase
  2. Create a new app by clicking the big 'Add Project' button

Wait a few seconds and watch the circle chase its tail

  1. Click "Add Firebase to your web app "
  2. Copy the api key

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDave OstranderView Question on Stackoverflow
Solution 1 - AndroidChad BinghamView Answer on Stackoverflow
Solution 2 - AndroidCommonsWareView Answer on Stackoverflow
Solution 3 - AndroidOrrView Answer on Stackoverflow
Solution 4 - AndroidManikandan KView Answer on Stackoverflow
Solution 5 - AndroidcharsiView Answer on Stackoverflow