One of the most useful features for iOS users is the ability to have relevant content delivered right to the device. Push notifications allow you to send messages directly to people who have installed your app (whether the app is running or not). Sending push notifications is a great way to engage your users and provide value.
If you’re an app developer thinking about adding push notifications (and you should be!), you may have a build vs. buy decision to make. Is it better to purchase push notification services from a 3rd party provider or does it make more sense to build them in house? There is a great deal to consider when making this decision and no single answer for everyone but let’s take a look at some things you should consider.
The Basic Push Notification Architecture
There are three basic parts to push notifications: client registration, push notification provider, and the notification service itself.
Client Registration and Tracking
The process for sending push notifications starts with some code in your app that registers the device with the notification service and acquires a unique ID for your app on a given device called a device token. The device token is used to identify the target for your notifications. It is the responsibility of the developer to store and manage the device tokens.
Push Notification Provider
The push notification provider is a server process created by the app developer to compose the notification package. The notification package includes the device token for a client application and the payload message. The provider server sends the notification to the Apple Push Notification Service which in turn pushes the notification to the device.
Apple Push Notification Service (APNS)
The Apple Push Notification Service sends the payload message to devices. If a notification for an app arrives when that app is not running, the device alerts the user that the application has data waiting for it.
The Feedback Service is another service provided by Apple. You’ll need to write the software to call the feedback service and get a list of device tokens for devices that no longer respond to your push notifications. In other words, if your app is uninstalled from a device, it will no longer respond to your push notifications and Apple gives you the device token for this device. Apple requires that developers check the feedback service periodically to keep Apple Push Notification Service from having to process undeliverable notifications.
Building the Push Notification Provider and Feedback Service
If you are planning on implementing push notifications in your app in house, you will need to develop the Push Notification Provider to call APNS as well as build the software to call the feedback service. Apple’s developer site provides detailed specifications for calling this service as well as the specs for constructing the notification payload. It’s a fairly complicated process but fortunately there are several resources available to developers to ease the development burden.
Open Source Libraries for APNS
There are a couple of popular open source projects that may save you time and headaches implementing APNS on your server. One of these is built with PHP whereas the other is built with Microsoft .Net (C-Sharp). Both are solid and fairly well maintained and documented so you may want to pick one of these based on your development skill set and deployment strategy.
For a PHP platform there is APNS-PHP (http://code.google.com/p/apns-php/). APNS-PHP is a full set of open source PHP classes to interact with APNS.
For a Microsoft based platform there is APNS-Sharp (https://github.com/Redth/APNS-Sharp). APNS-Sharp is a free, open source, independent and mono compatible C#/.NET Library for interacting with APNS.
Push Notification Service Providers
Until recently, your only option for sending push notifications to APNS was to build it yourself. Today there are a few companies that, for a fee, make implementing push notifications much easier. NativeX also provides a great free solution through our app services.
If you’re looking for a quality solution for your iOS push notifications and want to avoid the development effort of implementing a push notification provider yourself, apply for NativeX’s free app services program. If you have any additional insight on push notifications, please add it in the comments.