C2DM Prototype

As part of my current practicum project at CM-SV, I was asked to put together a prototype that demonstrates the capabilities of Google’s Cloud To Device Messaging (C2DM) service, or push notifications. What follows was the result:

https://github.com/patrickbaumann/c2dmprototype

c2dmprototype consists of two applications: a relatively vanilla Django server application (the Cloud part of C2DM) and an Android 2.2 application (the device part of C2DM). The demo aims to demonstrate the basic pieces of a “push to talk” application by allowing a user to send audio messages to devices by pushing them instead of requiring the battery-limited phone to poll the server. I’ll cover the purpose of the two applications below.

Django app:

As the server, this application has four basic tasks:

  1. Keeping track of registered devices.
  2. Storing audio files when they are posted from a device.
  3. Sending push notifications through the C2DM service to notify a device that audio is ready to be downloaded (this also requires authenticating with the Google account server).
  4. Serving the audio file to the phone in response to a HTTP post request.

Android app:

The Android application is responsible for the following tasks:

  1. Register with the C2DM server and forward a registration ID on to the Django server (registration only needs to be initiated by the phone once; the server will push when a new id is needed).
  2. Record audio and post it to the Django server
  3. When a push notification is received, extract the message id and download the audio from the Django server for playback

TheĀ applicationsĀ are far from complete (they’re prototypes after all), but they’ve boosted my interest in not only this practicum project, but my excitement to get to work with two frameworks I’ve struggled with in the past (Django and Android). This prototyping effort has pushed me into better understanding the technologies and I can’t wait to get started in implementing a full-featured push-based messaging service.