Android - GCM server key is not working with Urban

2020-03-30 05:26发布

I am trying to integrate Urban Airship Push notification service in my android project.I have created a new project in google developer console and created a GCM server key.I added that GCM key in Urban Airship configuration as well,but it fails to send the notification.

The Urban Airship Error Console throws an error like

Received push with invalid authorization on platform GCM error message

I already created a test project in google developer console 2 months back, and having a valid GCM key. If I integrate this key in UA it works fine. But If I create a new server key in same project that is not working.

Google project screen shot

API key 4 is recently created but it is not working the Server Key created on June 9th works fine. Is this because the key is auto generated? If that is the issue, how do I auto-create the GCM server key?

Recently, I heard that GCM is migrating to Firebase. Do I need to use FCM key instead of GCM?

1条回答
Viruses.
2楼-- · 2020-03-30 06:07

Seems that Google is no longer authorizing the API Keys created by Google API Console. I had a similar issue with Amazon SNS, and managed to fix it by using the Firebase auto-generated server key.

1 - Login into Google Firebase console, with the same credentials you used for Google API Console.
2 - Create a new project (or import an existing one).
3 - Click on the gear icon and select Project Settings

4 - Select CLOUD MESSAGING tab.

There you will see both the API Server Key and the Project number (which is needed in the application). This API Server key is the one you need to introduce in the Push Provider console (Urban Airship in your case).

查看更多
登录 后发表回答