2013-12-13 149 views
1

我长时间使用GCM,但使用新的Google控制台界面,行为有点不同。Android GCM - 新的Google API控制台

您必须创建项目并获取项目ID。这是GCM发件人ID。没关系。

但之后,你必须创建应用程序。

GCM文档说创建一个应用程序,然后单击“Android>直接从Android访问API”。

Docs here:http://developer.android.com/google/gcm/gs.html

这应该是在服务器中发送消息的API密钥,但它不起作用。

但是,如果我创建一个Web应用程序并获取“>服务器密钥> API密钥”它的工作原理!

这有道理吗?谢谢

回答

1

我遵循Android指定的确切步骤,它的工作原理与他们所说的完全相同。

为了获得API密钥:

1. In the sidebar on the left, select APIs & auth > Registered apps. 
2. Click Register app. 
3. In the Name field, type your app's name. 
4. Click Android > Accessing APIs directly from Android. 
5. Under Android identification, type the package name for your app. 
6. Enter an SHA1 fingerprint. To get this value, follow the instructions in the 
    console help. 
7. Click Register. 
8 .In the new page, open the Android Key section and copy the API key. You will need 
    the API key later on to perform authentication in your application server. 

而且我用下面的命令SHA1指纹:

密钥工具-exportcert -alias androiddebugkey -keystore C:\用户\ myusername \ .android \ debug.keystore -list -v

(和passw ord android

+0

是的,我遵循了这两个步骤。但正如我所说,这并不奏效。但是,如果我将密钥创建为Web应用程序,并获得SERVER KEY,它就可以工作。 – rlecheta

+0

@ rlecheta哪一步不起作用? – Eran

+0

我不能在服务器发送消息,它说无效的密钥。 – rlecheta

相关问题