C2DM - 如何使用一个发送者 ID 将消息推送到多个设备?
我有一个 Gmail 帐户注册了 C2DM。
我希望我的应用借助此帐户(在为每个设备请求注册 ID 和身份验证令牌后)能够向所有设备提供消息 应用程序安装在其中。
我想知道是否可以通过这种方式使用C2DM..
非常感谢
(有关任何详细信息,请询问我..)
ps我使c2dm在模拟器上工作,但当然我不能尝试之前写的内容因为我需要几部手机..
I have one single Gmail account signed up for C2DM.
What I would like is that my app, thanks to this account (after having requested registration IDs and auth tokens for each device), could be able to provide messages to all the devices in which the app is installed.
I want to know if is it possible to use the C2DM in this way..
Thanks a lot
(for any details, just ask me.. )
ps I made the c2dm work on the emulator, but of course I cannot try what written before because I would need several phones..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
抛开您的问题和评论,听起来您只是想知道是否可以仅使用一个发件人 ID 向不确定数量的设备发送 c2dm 通知。
这正是 c2dm 应该工作的方式。您创建一个发件人 ID 以在后端服务器上使用,并且该发件人 ID 在您的应用程序中用于注册 c2dm 通知。然后,您的后端会收集所有注册 ID,并使用您的一个发件人 ID 向感兴趣的各方推送通知。
Going off your question and comments, it sounds like you're just wondering if you can send c2dm notifications to an indeterminate number of devices using only one sender id.
That is exactly the way c2dm is supposed to work. You create one sender id to use on your backend servers, and that sender id is used in your app to register for c2dm notifications. Your backend then gathers all registrations ids and uses your one sender id to push notifications interested parties.
如果我正确理解你的问题,答案是:你不能。
对于您想要访问的每台设备,您必须向 google 服务器发送一个 http 请求。
无法向所有注册您的服务的用户广播消息。
这令人沮丧,因为就我而言,我为所有用户发送新闻通讯,因此与数百万用户建立连接的成本很高。
为了解决可扩展性问题,我创建了一个简单的 appengine map-reduce 任务,该任务循环遍历所有用户注册并创建到 google 服务的 http 连接,这是您可以达到的最快速度,因为它会根据您的交付需求动态实例化新服务器。
If I understood your issue correctly, the answer is: you can't.
You will have to send one http request, to google servers, for each device you want to reach.
There's no way to broadcast a message to all the users who have registered to your service.
It' frustrating because in my case I send a newsletter for all my users, so opening a connection to millions of users is expensive.
To solve the scalability issue I have created a simple appengine map-reduce task that loops through all the user registrations and create the http connection to the google services, it's the fastest you can go because it dynamically instantiate new servers for your delivery needs.
C2DM 已被弃用。 GCM 已经取代了它,它允许您使用一个 HTTP POST 向 1000 个设备发送消息。
C2DM->GCM 迁移指南:
http://developer.android.com/guide/google/gcm/c2dm.html
C2DM has been deprecated. GCM has replaced it, and it allows you to send messages to 1000 devices with one HTTP POST.
C2DM->GCM Migration Guide:
http://developer.android.com/guide/google/gcm/c2dm.html