Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 326
Dave Ostrander Avatar asked Nov 08 '13 19:11

Dave Ostrander


People also ask

How do I get my Google Cloud API key?

Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.


2 Answers

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

like image 183
Chad Bingham Avatar answered Sep 25 '22 08:09

Chad Bingham


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

like image 43
CommonsWare Avatar answered Sep 26 '22 08:09

CommonsWare