The Apple Push Notification Service (APNS) APNSallows applications to notify their users of remote events. If the user has turned on Notifications from the Settings application, her device will maintain a persistent IP connection to the APNS. Only one connection is maintained and all third-party notifications are forwarded (by providers) through Apple’s own servers.
Figure 14.1. A push notification from a provider to a client application
When a device receives a notification for an application and that application isn’t running, it notifies the user through an alert message or a sound, or by adding a numbered badge to the application. The APNS does not provide any feedback as to whether the message was successfully delivered to the user.
Apple argues, “Push notifications serve the same purpose that a background application would on a desktop computer” and that running applications in the background really isn’t necessary on a mobile platform outside of core services that the platform provides, such as phone calls and push email. It is not possible to run your own third-party applications in the background on the iPhone or iPod touch. Apple says, “...on a device such as the iPhone, background applications are, for performance and security reasons, prohibited. Only one application may be executing at a time.”
However, while Apple has provided detailed documentation regarding how to implement push notifications on the client (device) side, it provides only a high-level overview for implementing the provider (server) side.
Details of the APNS are given in the Apple Push Notification Service Programming Guide available via the iPhone Dev Center.
Unfortunately, there is also little in the way of third-party documentation at the time of this writing as to how to communicate with the APNS to send the messages that are then pushed to the phone. However, some off-the-shelf third-party implementations are available. If you intend to implement push notifications in your application, these are probably the best places to start:
Perl wrapper code implementation that acts as a provider allowing you to send push notifications using the APNS. Seehttp://github.com/ty...event-apns-perl and http://search.cpan.o.../AnyEvent-APNS/ for more details.
A set of PHP scripts which you must run as services and which allow you to send push notifications using the APNS. Seehttp://code.google.com/p/php-apns/ for more details.
A daemon written in Ruby that acts as a provider to the APNS. The daemon maintains a persistent connection to the APNS for best performance. See http://code.google.c...by-apns-daemon/ for more details.
Learn more about this topic from Learning iPhone Programming.
Get the hands-on experience you need to program for the iPhone and iPod Touch. With this easy-to-follow guide, you'll build several sample applications by learning how to use Xcode tools, the Objective-C programming language, and the core frameworks. Before you know it, you'll not only have the skills to develop your own apps, you'll know how to sail through the process of submitting apps to the iTunes App Store. Once again, thanks to Answers.oreilly.com & adfm