Deacon: Android’s latest bundle of joy
Update: It seems a whole lot of folks are finding this page from searches and referring links - Deacon has come a long way in since the project was announced on this blog post! Please check out the latest on the blog, as well as the project's GitHub page, to get the latest information.
It all started as a friend and I sat in a bar this past January in January of 2010, commemorating his birthday with some celebratory beverages. On his hip, an iPhone 3GS. On mine, my Motorola Droid, a shade over 3 months old. On TV, a Buffalo Sabres game.
Turns out, my friend is a pretty big Sabres fan. And each time a goal was scored in the game, his iPhone would buzz, displaying an update. I found this to be very cool, and quietly lamented the dearth of good real-time sports apps for Android. Upon returning home and doing some Googling, I discovered that Android doesn't really have any native capability for push notifications. The iPhone has - since OS 3.0 - as this video from CNet describes:
Unfortunately for iPhone developers, to paraphraseblatantly rip off 1st Timothy, there was but one way to push notifications, and that way was through Apple. Unless developers wanted to use Apple's servers for their push notification deployments, they were stuck - though I'm sure they're used to having their hands tied by the gang from Cupertino.
Doing some more hunting, I discovered a company called Xtify, who offer push notification services for Android app developers. Just run your messages through their servers, and viola! you're pushing them out to users. What's more, the Xtify solution can target notification "campaigns" to users based on their location - which is pretty cool. But still, app developers' hands are tied - the only way to send out their notifications is through Xtify's servers.
All that hunting done, I didn't really give it a second thought. After all, I'm not exactly writing any ground-breaking Android apps right now, and at the time I couldn't think of much I'd do with push notifications outside of sports scores. But then Apple announced iPhone OS 4, and along with it, a new twist on push notifications:
Push notifications - Receive alerts from your remote servers even when your app isn't running.
Notice that little 4-letter word in the middle? "Your" remote servers. Starting in the forthcoming OS 4.0, it looks like Apple will be letting developers run their push events through their own servers, and that's a big deal. (Update: Turns out, this isn't the case - iOS developers must still send push notifications through Apple's servers.) For one thing, Apple releasing their iron-fisted grasp on anything content-related is a big deal. But it also means a lot more options for app developers. Options that Android developers ought to have, too.
I decided this whole "push" thing needed a little more attention - and as a time-starved software grad student, what other reason should I need to dig deeper? I found a few ideas on the intertubes - custom implementations of XMPP (somewhat akin to what Google does with the GMail and Google Voice apps), long-held TCP connections into custom backends, and maybe a few other ideas not memorable enough to recall tonight. Unfortunately, none of them were even usable implementations, let alone ready to be used by app developers. Then I remembered a cool project I'd read about while researching push updates for liveblogs: Meteor.
Meteor is a lightweight web server (the whole shebang is under 40KB) that enables streamed, polled and long-polled HTTP-based push notifications to web browsers. The server side opens up sockets for incoming client connections, as well as data sources that can create messages to push to those clients. The client side does a pile of magical browser munging, cleverly dodging XSS security restrictions and enabling those updates to be received and placed into an open web site. How does this relate to Android?
Since Meteor uses long-held TCP connections to implement its push notifications (man I'm getting tired of typing that), provides configurable keepalives, and can be plugged into just about any notification source, it's a perfect starting point as an Android push backend. All that's needed is a native Java client library, and we'll be in business - any app developer that wants to add push notifications to their wares can set up a meteor server (or connect to an existing one) and start creating cool real-time services.
While I'm a big fan of Xtify and the cool stuff they're enabling, I'm also a big fan of independence and autonomy. I don't like the idea of depending on a third-party's server to make my app work - and if that app depends on real-time events, that dependence is wired straight into the app's core. I'd much rather handle my own back end (wouldn't we all?), and be able to wire (perhaps literally) anything I want into it. If someone is savvy enough with Java to write Android apps (no small feat) then they're definitely sufficiently handy to set up a Meteor server.
I'm sure there will be some critics of this effort. Several folks have already spoken up elsewhere with concerns about battery life and network continuity concerns. But if long-held TCP connections are so bad for battery life, how can Google get away with using them for near-instantaneous GMail and Voice pushes? I'm sure we'll discover - in intimate detail - just what implications will come with implementing such a thing on Android. And I hope you'll join me in the exploration!
iPhone OS 4 has been announced for release this summer, and the developer preview is already out. If the latest rumors about a June release of the next iPhone are to be believed, then OS 4 will probably arrive around the same time. The pressure is on - can the Deacon Project enable Android developers with an independent-server push notifications platform system cobbled-together library before iPhone OS 4 hits the streets? If I'm working alone, probably not - but perhaps with a little help, it might be doable. If you're handy with Java and interested in kicking in a few hours to a nascent project, drop me a note at (dave) (at) (daverea) (dot) (com) or hit me up in the comments section.
So, to sum up this long-winded post (kudos to those who've made it this far), I'm proud to announce The Deacon Project - Push Notifications for Android. Deacon will be a native Java library that enables server-based push messaging to Android phones using comet technology. Keep tuned in here for more information, including links to Deacon's repository, perhaps a mailing list, and a proper explanation of why it's called Deacon (and why not).

April 16th, 2010 - 05:46
Oh hai~!
Dave, im impressed. Period. I want to help as much as i can! Open-Source hurray!
Let me know when, where and what asap and ill see what i can do! Can we build it? Yes we can! Sorry had to say it…
-SM
August 18th, 2010 - 00:00
Have you Dave looked into having Deacon (Android) communicationg between other push servers like cometD+jetty or APE? Can you clarify maybe I didn’t understand Meteor.
August 18th, 2010 - 09:13
Hi SB – I have not done much investigation into alternate push sources, though others have asked about cometd. Contributions to that effect would be welcome, however!
January 27th, 2011 - 02:33
Does Meteor Only run on linux platform ?
January 27th, 2011 - 08:02
To my knowledge, Meteor is only officially supported on Linux. However, it is written in Perl so it is feasible that it could run on other platforms with the appropriate Perl environment.
February 2nd, 2011 - 04:14
Hi Dave, I am new to android and want to learn more about push notification. I’ve installed Meteor server in my system. I am able to run by using “home.daverea.com” as host. How to run your demo application which in github site by using my meteor server.
Pls assist me..
February 2nd, 2011 - 07:20
Hi Bhargav-
Thanks for your interest in Deacon. Did you install Meteor with the meteord.conf file found in the Deacon source repository? This file reformats Meteor’s output to be more network-efficient, and Deacon expects this format when connecting to a server. One of our goals for the 1.0 release is to make this configurable, but for now the meteord.conf file from the Deacon repository must be used.
Please feel free to join the Deacon mailing list at http://www.deaconproject.org/mailing-list – this way your questions and answers will be archived in searchable form, so that others can benefit from them in the future.
Thanks,
Dave
February 2nd, 2011 - 09:05
Thanks for quick response.
I followed installation guide http://www.meteorserver.org/installation.
Do you want me to install Meteor server with meteord.conf file in Deacon source repository.
February 2nd, 2011 - 09:41
Just replace the existing /etc/meteord.conf file with the one from the Deacon repository, then re-start the Meteor server.
August 10th, 2011 - 02:54
Hello Dave,
I am not sure if this is the correct place. I am looking for document on how to setup and send push messages using Meteor server.
I’ve already installed Meteor and I tested Deacon library using the demo you provided, but I want to create my own channel and send notification.
August 10th, 2011 - 07:49
Hi Khalid – Check out the Meteor server documentation at http://meteorserver.org/server-docs/ – specifically the “Event Controller Command Protocol”
Hope this helps!
August 10th, 2011 - 21:45
Thank you so much Dave.
I like this project so much.
October 12th, 2011 - 02:14
Hi Dave,
This is exactly what I needed in my project, to push directly from my server to the application, without involving any 3rd party servers. Deacon Project surely looks promising!
I wanted to learn more about push notifications in android. Can you tell me how were you able to push directly from meteor server to the app? Does android provide means to directly push?
October 12th, 2011 - 08:41
Umang – thanks for your interest! Deacon is not an app, but rather a library you can use in your apps to deliver push messages. Deacon uses a raw TCP/IP connection and the Meteor server’s HTTP-like long-polling protocol layer. Android doesn’t have a built-in facility to receive direct push messages; the platform’s C2DM solution uses Google’s third-party servers for this. It does provide the basic networking functions we needed in order to build Deacon as a Meteor client.
October 13th, 2011 - 02:04
ok.. as you are using Meteor server to push, how can I use my own server to push notifications to my application? Is there a way to use Meteor server along with my own server?
October 13th, 2011 - 07:38
Meteor server isn’t a specific server, it’s a piece of server software that you can install and run on your own server computer. See: http://www.meteorserver.org/
App developers using Deacon have successfully set up the Meteor Server on both Linux and Windows OS, but the official documentation and support is only for Linux hosts.
October 13th, 2011 - 09:12
ohk.. this makes things much clear now. One last doubt, I was not able to find anywhere how to run meteor server on windows.. can you suggest a way to do it?
January 18th, 2012 - 09:09
I have some problems with my deaconservice, where can I ask my quastion ?
January 18th, 2012 - 09:35
Since we do not have the mailing list working right now, please file an issue on the Deacon github project and tag it as a question. We can use the discussion features there to get it answered, then close it out once you’re up and running.