Android - GCM 服务器密钥不适用于 Urban Airship [英] Android - GCM server key is not working with Urban Airship

查看:14
本文介绍了Android - GCM 服务器密钥不适用于 Urban Airship的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Urban Airship 推送通知服务集成到我的 android 项目中.我在谷歌开发者控制台中创建了一个新项目并创建了一个 GCM 服务器密钥.我也在 Urban Airship 配置中添加了 GCM 密钥,但它失败了发送通知.

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.

Urban Airship 错误控制台抛出类似

The Urban Airship Error Console throws an error like

Received push with invalid authorization on platform GCM error message

两个月前我已经在谷歌开发者控制台中创建了一个测试项目,并且拥有一个有效的 GCM 密钥.如果我将此密钥集成到 UA 中,它可以正常工作.但是如果我在同一个项目中创建一个不起作用的新服务器密钥.

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.

API 密钥 4 是最近创建的,但它无法正常工作 6 月 9 日创建的服务器密钥工作正常.这是因为密钥是自动生成的吗?如果这是问题所在,我该如何自动创建 GCM 服务器密钥?

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?

最近,我听说 GCM 正在迁移到 Firebase.我需要使用 FCM 密钥而不是 GCM 吗?

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

推荐答案

似乎 Google 不再授权 Google API Console 创建的 API Keys.我在使用 Amazon SNS 时遇到了类似的问题,并设法通过使用 Firebase 自动生成的服务器密钥来修复它.

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 - 使用与 Google API 控制台相同的凭据登录 Google Firebase 控制台.
2 - 创建一个新项目(或导入现有项目).
3 - 点击齿轮图标并选择 Project Settings

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 - 选择 CLOUD MESSAGING 选项卡.

4 - Select CLOUD MESSAGING tab.

您将在此处看到 API 服务器密钥和项目编号(应用程序中需要该编号).此 API Server 密钥是您需要在 Push Provider 控制台(在您的情况下为 Urban Airship)中引入的密钥.

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).

这篇关于Android - GCM 服务器密钥不适用于 Urban Airship的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆