“Push” Notification to Mobile Devices via SMS

One of the questions I seem to get on a frequent basis is “How is push notification implemented?”. Push notification is extremely useful for mobile devices; whenever there is a power constraint, typical polling/pull approaches will tax the device’s battery. Some examples of Push vs. Pull:

Push

  1. ActiveSync
  2. Gmail on Android

Pull

  1. IMAP/POP3 email (user configurable polling interval)
  2. Twitter Clients (which checks Twitter periodically)

The obvious problem with polling cycles and pull is that the phone needs to come out of sleep/power save periodically and poll the server for messages: and there may be none waiting! For example, if you set a 5 minute email check interval on your Windows Mobile phone’s IMAP/POP3 account, your battery will be dead before the end of the day.

As far as I know, there are two ways to implement Push notification to a mobile device:

  1. Persistent TCP/IP Connection: Ideally the server would initiate the connection to the phone, but most phones do not have a static IP address available to them. Thus, generally, the phone initiates and maintains the connection. I know that actually maintaining a connection indefinitely will also drain the phone’s battery quite quickly due to a constant stream of keep-alive pulses. I’m a little hazy on the details here, but I have read that ActiveSync actually utilizes connections with a 15 to 30 minute time out to get around this problem.
  2. SMS: This is the ideal way to implement push, as the client only gets notified via SMS when there is something new on the server. Beware potential SMS costs that may be incurred.

 

Setting up SMS Interceptors

So, how does a developer use SMS to to implement a custom push solution? Well, first, the phone needs to set up an SMS interceptor: you don’t want to be sending protocol related SMS to the user’s Inbox!

Android: Register a receiver that watches for the android.provider.Telephony.SMS_RECEIVED broadcast.

Windows Mobile: Set up an Application Launcher for SMS events.

 

By way of SMS message prefixes, a developer can the specific SMS that are meant to be handled by the application. For example, a sample SMS in my custom protocol could be:

Koush: Poll!

By filtering SMS that begin with “Koush:” as they arrive, the user will never see them, and my application can utilize them to implement Push notification.

 

Sending an SMS to a Phone

There are several web services that allow you to send an SMS to a phone. Some free, some not. In the free category, I would recommend trying ZeepMobile. It’s easy to set up, and the API is straightforward.

 

Code sample and demo coming in a later post!

7 comments:

Sean Payne said...

Hey thanks for the info! I've been wondering about using SMS for push-style functionality as well as a free SMS API on the net!

Anonymous said...

Good info! However, you should be aware of IMAP IDLE. It's a widely-implemented feature from RFC2177 that functions in a similar way to Exchange's persistent TCP/IP connections. Outlook Mobile doesn't support it, unfortunately.

Koush said...

hi, I read about IMAP idle a while back. But for ease of implementation, SMS interception takes the cake.

plastiswafer said...

Hello, I was wondering if you could help me with a minor issue I was having with an addon you developed. Recently someone has been terrorizing people in the city of Stormwind with tells from a Vent Checker program, informing them that no vent has been detected and if they do not comply then they will be terminated. I do not want to be terminated! This is terribly annoying and I was wondering if there were any way to shut down the mod from the recepient's end. I tried finding this program on the net but was unsuccessful.. if you have any tips or commands I could run to stop vent checker from invading my ports, that would be fantastic. When I used -ventchecker /about it pointed me to this website, stating it was developed by Kdutta systems, so hopefully I am not in the wrong place.
Thanks!

@~ said...

Not exactly in line with this, but almost every cellular provider, at least in the US and EU provide e-mail to SMS services.

http://www.tech-recipes.com/rx/939/sms_email_cingular_nextel_sprint_tmobile_verizon_virgin/

--Not my site.

Anonymous said...

Unfortunatelly Zeep just works for US Phones.

josh schiffman said...

check out Xtify - xtify uses an SDK for easy implementation and has a web console and web service to configure messages to one, some or all of your users. works across android, iphone and blackberry.

you can create rules that determine when a message gets sent – you can even push notifications using location as the trigger as the SDK runs in the background and provides access to persistent location.

reach out with questions to business@xtify.com