I was recently e-mailed by someone who was investigating some of the new managed APIs for Windows Mobile 5.0. While there were some technical questions, one of the "non-technical" questions immediately caught my attention -
"I noticed that it is possible to intercept SMS messages now. Why would anyone writing a business application want to do this?"
These are some of my favorite questions. For all of the "hows" that are out there, we sometimes forget about the "whys" - Why would this be useful, why would we consider implmenting this, etc. As developers, sometimes we can't see the proverbial forest through the trees. A seasoned developer should always ask the "whys" first; if there is no applicability to there task at hand, maybe they should save the "how" until it is really needed (focusing more on what they need to know versus what they'd like to know). As someone who has made a career of having to keep up with multiple platforms, technologies and languages over the years, this simple rule has managed to keep me sane (and get at least a couple of hours of sleep per night). But let's get back to the question at hand - why even use SMS interception?
There are any of a number of possible uses for SMS interception. Perhaps the Number One possibility I pass along to line of business application developers in Windows Mobile scenarios is adding push functionality. Because of the very nature of Windows Mobile devices and applications as "occasionally-connected", a common developer task is to synchronize data between the device/application and a remote data source. The mechanisms for this (merge replication, synchronization, Web Services, etc) are irrelevant to this discussion, because the greater question to be asked is not how should data be synchronized, but when. As a developer, you have two distinct choices -
- Polling. Your application can poll for changes on the server, initiating a synchronization when a change is determined. Depending on the infrstructure of the server, this can be either easy or difficult and potentially costly in terms of resources.
- Push notification. If the trigger mechanism for synchronization is a change on the server and the server knows that a change has occurred, wouldn't it be more effective for the server to simply let affected clients know of the change?
In many cases, push notification would be a desired alternative. Until recently, however, push notification was not easy to perform with Windows Mobile devices. Remember, these are not persistently-connected clients. The new managed MessageInterception namespace and objects provide an easy and effective way for an application to listen for "that special SMS message" that says "now would be a good time to connect".
As always, there are the considerations you should take into account with using SMS messaging as a push notification method -
- You would need an SMS gateway server-side to enable the sending of the notifications. The good news here is that there are any number of free or low-cost SMS gateway solutions that are also easily programmable;
- Potential cost of SMS messages. Many cellular plans (especially in North America) do not include SMS messaging, thus resulting in an addition per-message cost per user.