UrbanAirship Android Received push with invalid authorization on platform GCM

Mar 19, 2014

I was trying integrate Urban Airship to an android application so that I could send push notification to all registered android devices via Google’s GCM (Google Cloud Messaging for Android) service.

Urban Airship does have a really good documentation about to how to set it up on Android: Android: Getting Started with Push. So I followed the instruction above and integrated with android app locally. But when I try to test the push notification by going to Messages -> Test Push in the left panel like following screenshot .

It keeps saying Received push with invalid authorization on platform GCM.

Well, I did verify each steps illustrated in the troubleshooting guide, the api key, package, sender id and so on. Still no clue for it.I take a step back and think the problem clearly refers to “invalid authroization on platform GCM”, then it should be something wrong with GCM settings.

4.Generate an API Key
A. Click on the text where it says “Google Cloud Messaging for Android” in the image above.
B. This takes your to the Google APIs page. Click on API Access.
C. Urban Airship takes care of API Access authorization for you, so you do not need to create an OAuth 2.0 client ID.
D. Click on “Create a new Server key...” to generate your API Key.
E. Do not specify any IP addresses in the form, and click “Create”

What I realized is that holy **, it is god dammned Server key instead of Android key. I did go back and take a detail look at what android key is about:

Create an Android key and configure allowed Android applications
This key can be deployed in your Android application. API requests are sent directly to Google from your client Android device. Google verifies that each request originates from an Android application that matches one of the certificate SHA1 fingerprints and package names listed below. You can discover the SHA1 fingerprint of your developer certificate using the following command:
keytool -list -v -keystore mystore.keystore

Then I understand it better. Because ubarn airship is acting on our app’s behalf dealing with GCM platform rather than let our app do the dirty job. So serve key makes sense to me now.