C2DM 到 Google 云消息传递 (GCM) [英] C2DM TO Google Cloud Messaging (GCM)

查看:16
本文介绍了C2DM 到 Google 云消息传递 (GCM)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可能已经看到,Google 正在迁移其推送通知系统.

As you may have seen, Google is migrating its Push Notification System.

GCM 的 Google 开发者指南

我想我不是一个人想知道:从 C2DM 获得的令牌对 GCM 仍然有效吗?

I guess I am not alone wondering : are the tokens obtained from C2DM still valid for GCM ?

如果没有,这意味着我需要所有用户使用新版本更新我的应用程序,更新我服务器上的令牌......

If not, it means that I need all my users to update my app with a new version updating the tokens on my servers ...

我可以保留并行系统,但我认为这不是一个好的解决方案

I can keep the parallel systems which is something I don't think it's a good solution

继续使用 C2DM 直到它完成,然后我就死了:-)

Continue using C2DM until it's finished, then I die with it :-)

推荐答案

尽管客户端迁移很容易(只需将发件人"从电子邮件地址更改为项目 ID),但如果您的应用已经使用 C2DM 一段时间.在此处查看我的问题:向现有 C2DM 注册 ID 发布 GCM 通知

Although client side migration is easy (just change the 'sender' from email address to a project id), you will still face transition headaches if your app has been using C2DM for a while. See my question here: Posting GCM notification to existing C2DM registration ids

基本上问题出在转换期间,您需要维护旧 C2DM 应用程序的设备注册 ID,以及使用 GCM 的新应用程序的新注册 ID.除非您可以强制所有用户一次全部升级,否则您必须在服务器中构建额外的逻辑(即在数据库表中添加一个新列以指示 GCM reg id)来处理向 C2DM 和 GCM 发送通知可预见的未来.

Basically the problem is during the transition, you need to maintain device registration ids from the old C2DM app, and the new reg ids from your newer app that uses GCM. Unless you can force all your users to upgrade all at once, you have to build additional logic (i.e. add a new column in the database table to indicate GCM reg id) in the server to deal with sending notifications to both C2DM and GCM for a foreseeable future.

如果您的服务器只向所有设备发送通知,那么这应该很容易迁移,因为您可以将 C2DM 和 GCM 通知发送到数据库中的所有设备,并逐步从旧的 C2DM 注册中删除陈旧或未注册的设备.随着时间的推移,您应该会在数据库中看到越来越少的 C2DM 设备注册 ID.

If your server only send notifications to all devices, then this should be easy migration, as you can just blast both C2DM and GCM notifications to all devices in your database, and progressively remove stale or those NotRegistered devices from the old C2DM registrations. As time goes by you should see less and less C2DM device registration ids in your database.

这篇关于C2DM 到 Google 云消息传递 (GCM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆