When Apple announced that the iPhone OS would allow only one userland application (i.e., a non-Apple application that the user installs) to run at a time, many developers were upset. Blogs and mailing lists buzzed with conversations in which developers felt they were being locked down too tightly. Apple then presented an alternative to having some applications run in the background. Using current buzzwords, the Apple solution was to have the application run in “the cloud” instead. That is, your application could be developed with an analogous online service that could keep track of external events and, at important points, could notify a service hosted by Apple of the change. Apple could then push the notification to related devices, with the result being that the iPhone OS could add a numeric badge graphic to the application icon on the Home screen. The numeric badge is a standard user interface enhancement for Cocoa applications. When the desktop Mail application receives new email messages, it adds a small red circle or oval to the Mail icon in the Dock. Inside the red shape is a number indicating the number of new, unread emails.
The push service can also display an alert message on the device and play a short sound (using audio files included in an application) if developers wish. Generally, though, it is best to avoid such disruptive notifications, saving them for very important circumstances.
Take for example an instant messaging client. A developer could release a client application that runs natively on the iPhone, but only in the foreground. If, upon termination of the application, the user remains available for messaging within the online instant messaging service, that service could notify Apple when a new message comes in. Apple would then push a notice to a device, leading to a numeric badge on the application icon representing the number of unread messages.
Another example is an online image hosting service such as Flickr. A developer could create an iPhone application that uploads photographs from the iPhone to Flickr. A separate service hosted by the application developer could monitor the Flickr upload and send a push notification through Apple when new comments are added to the photo on Flickr.
This push model is still somewhat controversial, as it only partially solves some of the needs of background applications. Still, knowing about the service as it comes to fruition will be important, especially in the context of the cooperative single-tasking ideals. This is because it frames each application as not only part of the user experience of the device, but as part of a network of interconnected services: mail, web, messaging, and any number of proprietary and tunneled protocols and services.