Joe MooreJoe Moore
Android Tidbits 6/21/2011: Unregister? Nah!
edit Posted by Joe Moore on Tuesday June 21, 2011 at 09:51AM

C2DM Unregister Issues

It turns out when you follow the client-side C2DM unregistration process, this does not guarantee that those registration tokens are permanently unregistered for that device.

If we unregister as specified above and then send a push notification to that registration_id, the server receives an Error=NotRegistered as expected.

But, unexpectedly, when that device re-register with C2DM (and getting a new registration_id), the old registration_id is reactivated as well and can receive push notifications and does not result in a server-side Error=NotRegistered.

The end result: we implemented our server-side API to take both the new and old registration_ids when the Android client successfully registers with C2DM, allowing us to manually delete the old registration_id.

Drawable XML Files

Prefixing the name of a drawable xml file with "active_" seems to prevent android from using that drawable at all.

Joe MooreJoe Moore
Android Tidbits 6/9/2011: CD2M Resources
edit Posted by Joe Moore on Friday June 10, 2011 at 07:16AM

C2DM

One of our projects just started implementing the Android Cloud to Device Messaging (C2DM) framework. We'll keep you posted as we progress through the many pieces of this implementation. Various resources include:

  • Official Google code page: Google Projects for Android: C2DM
  • Sign up for the service -- you'll need a Google account, like GMail or a hosted Google account.
  • There is no official Android client library for handling these messages. There is a de-facto standard set of classes, as used in JumpNote and Google Chrome to Phone Extension. Most blog and forum posts say something like "Download those classes and tweak as needed."
  • Wei Huang from Google posted an article about implementing C2DM.
  • Now for the Ruby part -- wait, Ruby? Yes, there is a big server-side component to C2DM. Your message-pushing server must not obtain an authorization token from Google to communicate with the service, but also keep track of the authorization tokens from each device that needs to receive push notifications. We are implementing a server-side API for our devices to register their C2DM tokens. Also, the awesome folks at GroupMe have open sourced a c2dm gem for Ruby servers to both authorize with Google and post notifications.