如何在GCM代码android中使用生成的API密钥 [英] How to use generated API key in GCM code android
问题描述
我想将GCM集成到Android应用程序中,我已经在其中注册了我的应用程序并在Google开发者控制台上启用了GCM服务,同时也创建了API密钥。
I want to integrate GCM in android application for which I have registered my application and enabled GCM service on google developer console also created the API key.
放哪里这个API密钥在android代码中?
Where to put this API key in android code ?
任何帮助表示感谢。
推荐答案
您不必在android代码中使用API密钥。
You don't have to use api key in android code.
您必须在服务器端使用此api密钥发送通知并在android代码中使用项目编号为GCM注册设备并获取用于接收通知的唯一设备ID。
You have to use this api key at server side to send notifications and use project number in android code to register device for GCM and obtain unique device id for receiving notifications.
使用GCM的步骤
- 使用GCM注册Android应用程序以接收注册IDRegId
- 将RegId与服务器
-
- Register the Android app with GCM to receive Registration Id "RegId"
- Share "RegId" with the server
- Send a message from server to GCM using HTTP POST request
You can read step by step implementation of GCM here.
这篇关于如何在GCM代码android中使用生成的API密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!