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?
Solution 1:
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.
Log in to Google Services with your google account. (This is not the same as the Google Console)
Click on Pick a Platform
Click on Enable services for Android
Fill out the app name and package name
Select Cloud Messaging. (Or any other service you want. You can come back to this later and add more)
Click on Generate Configuration Files
Boom. Right there on top in the Cloud Messaging card under Server API key
Also, you will want to download the
google-services.json
file and copy it to theapp/
ormobile/
module directory in your Android project
Solution 2:
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:
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:
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 :)