Dave Ostrander
Dave Ostrander

Reputation: 625

Getting an API key to use with Google Cloud Messaging

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?

Upvotes: 59

Views: 97621

Answers (5)

charsi
charsi

Reputation: 3817

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

  3. Click "Add Firebase to your web app "

  4. Copy the api key

Upvotes: 1

Chad Bingham
Chad Bingham

Reputation: 33846

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

Upvotes: 76

Manikandan K
Manikandan K

Reputation: 921

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 :)

Upvotes: 4

Orr
Orr

Reputation: 4840

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

Upvotes: 5

CommonsWare
CommonsWare

Reputation: 1006574

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

Upvotes: 50

Related Questions