Before the Android application is able to receive the notifications, you must authenticate yourself with Google as a developer. Luckily this is both easy and free to do, and doesn’t require much set-up. Like iOS, you are only able to test out your push notifications in a real device.
First, we must authenticate with Google. Google offers the Google Cloud Messaging (GCM) platform, formerly known as Cloud to Device Messaging (C2DM). You will need a Google Account for this. Now open the Google Cloud Console.
If you haven’t created a project, click “Create Project”:
Now give the new project a name:
Once the project has been created you will see the overview screen. From there grab the project number (used later as the Sender ID):
Now you need to enable the Google Cloud Messaging Android APIs. To do that, navigate to
APIs & auth >
APIs and scroll down to the Google Cloud Messaging Android item, which you need to turn on:
Now we need to register our application and state that we are accessing the Google APIs from a Web Server, the AeroGear UnifiedPush Server in this case. First go to
APIs & auth >
Credentials and inside of the Public API access area click the red CREATE NEW KEY button. This launches the following popup, where you select the
Server key option:
On the next screen we just click the blue
Create button to create our Server Key:
For extra security, you may whitelist an IP address (or multiple) for the sending server
On the last screen we are finally get to see the actual value of the generated Server Key, which we will use later:
Now that Google is ready to accept and deliver our messages, we are ready to setup the UnifiedPush server.