C2DM TO Google Cloud Messaging (GCM)
Asked Answered
Z

3

13

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

Google Developer guide for 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 ...

OR

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

OR

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

Zante answered 27/6, 2012 at 18:36 Comment(0)
E
13

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

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.

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.

Equidistance answered 28/6, 2012 at 17:44 Comment(1)
Glad I'm not alone having this issue, well I don't really like the idea of maintaining two systems, but I don't really want to throw my existing tokens ... :-(Zante
P
3

I had migrated my app from C2DM to GCM. No, I shouldn't say migrated. The correct term to be 'co-exist' for both C2DM and GCM. Because I can't force all my current user upgrade to GCM. My goal is to make sure both new(refer to GCM) and exist(refer to C2DM) user able to get push messaging.

For the client side:

  1. Change sender to project id

For the server side:

  1. Add a new column in the db to store GCM registration id.
  2. If user record with gcm register id > then push to gcm server > else c2dm server

So far I am able to achieve my objection. But my only concern is, when the c2dm going to fully shutdown? If the day really coming, how I suppose to force my old user upgrade to gcm?

Patrizio answered 5/7, 2012 at 2:37 Comment(1)
I agree with 'co-exist', but not a clean solution :-/ I have in the user-agent a way to know which app version the user is using, and I can force upgrade on launch, but may sound a bit brutal (and so will loose users), that's why I want to avoid it.Zante
C
1

There is a migrating guide on the Android developer documentation site.

C2DM will continue to give support for a while, It is better to migrate our application in GCM and publish a updated version of our application. (As per my thinking)

Canaanite answered 27/6, 2012 at 19:15 Comment(2)
That's exactly what is recommended in the migration guide. First look at the migration guide looks like its going to be easily migrated for many applications.Variolite
Ok, but how will you handle the transition ?Zante

© 2022 - 2024 — McMap. All rights reserved.