标签:
aws云服务提供了非常完善的服务,移动设备的消息推送服务也非常不错,且费用极低、性能良好。
虽然aws官网上有很详细的步骤说明,但是偶还是走了一大圈弯路,主要由于对于Google的接触实在太少,以至于在使用Google cloud message方式发送消息的时候绕了个圈圈。
首先,aws官网文档说明:http://docs.aws.amazon.com/zh_cn/sns/latest/dg/mobile-push-gcm.html
进入Google网站,登录Google账号(以下是官网文档,翻译在后面)
To create a Google APIproject:
1. Open the Google DevelopersConsole.
2. If you haven‘t created an API project yet, click CreateProject.
3. Supply a project name and click Create.
Oncethe project has been created, a page appears that displays your project ID andproject number. For example, Project Number: 670330094152.
4. Copy down your project number. You will use it later on as the GCMsender ID.
To enable theGCM service:
1. In the sidebar on the left, select APIs &auth.
2. In the displayed list of APIs, turn the GoogleCloud Messaging for Android toggle to ON.
1 打开Google开发者控制台:https://cloud.google.com/console
2 如果尚未创建API项目,点击CreateProject(创建项目)
3 输入项目名称并且点击create(创建)
PS:尽量不要带空格,project id自动生成即可
项目一旦被创建之后,会自动跳转到项目详情页面,可以看到project id和project number,比如Project Number: 670330094152.
4 将project number复制下来,会在后面作为GCM sender ID用到。
1 在左侧的菜单页,选择APIs & auth
2 在展示出来的API列表,选择Google Cloud Messaging for Android,并将开关设置为ON
To obtain an APIkey:
1. In the sidebar on the left, select APIs &auth > Credentials.
2. Under Public API access, click Createnew key.
3. In the Create a new key dialog,click Server key.
4. In the resulting configuration dialog, supply yourserver‘s IP address. For testing purposes, you can use0.0.0.0/0.
5. Click Create.
6. In the refreshed page, copy the API key. You will needthe API key later on to perform authentication in your application server.
Note: If youneed to rotate the key, click Regenerate key. A new key will becreated. If you think the key has been compromised and you want to delete itimmediately, click Delete.
1 在左侧的菜单页,选择APIs &auth > Credentials
2 在Public API 标签页,选择Create new key
3 在Create a new key对页面,选择Server key
4 在结果确认页面,输入你的服务的IP地址,如果是为了测试用,可以使用0.0.0.0/0.
5 点击Create
6 在刷新后的页面,复制API key.后面的应用服务平台用到这个API Key
注意:如果你需要重新获取API key,点击 Regenerate key.会创建一个新的key。如果你认为这个key不安全并且想要立即删除,点击Delete.
标签:
原文地址:http://blog.csdn.net/sundenskyqq/article/details/43307365