现在的位置: 首页 > 综合 > 正文

android: Google Cloud Messaging (GCM)

2013年10月30日 ⁄ 综合 ⁄ 共 1040字 ⁄ 字号 评论关闭

GCM是第二代的google message service, 第一代是c2dm。 目前c2dm已经相当于不能用了,因为它不在允许新的android注册和使用c2dm。

如何创建一个最简单的app和相关的server side. (ref
link
)

1. 首先要有一个google account,and then access Google APIs Console page (https://code.google.com/apis/console).
2. 在"Dashboard" page里为你的要使用gcm的android app创建一个project: 在该page select左上角的下拉框 "Other projects > Create",然后给一个project name。
3. 创建好project后,就会进入该project的management web page。查看该page的url (类似于: https://code.google.com/apis/console/?pli=1#project:1241100000:overview),其中的"1241100000"将会作为GCM sender ID!!
4. click "Services" tab, Turn “Google Cloud Messaging” toggle to ON
5. click "API Access" tab, click "Create new Server key", click "Create" button. 这就会创建一个Key for server apps。其中的API key等下会用到。

Note: If you need to rotate the key, click Generate new key. A new key will be created while the old one will still be active for up to 24 hours. If you want to get rid of the old key immediately (for example, if you feel it was compromised), click Delete
key.

6. 剩下的步骤就是开发client side and server side code,参看http://developer.android.com/guide/google/gcm/gs.html

GCM server side C# version:

http://www.dotblogs.com.tw/shadow/archive/2012/07/05/73236.aspx

【上篇】
【下篇】

抱歉!评论已关闭.