Apple Push Notifications Service API & C#

To start with Apple Push notifications I would have to first explain what is Push Notifications?

In normal mobiles Push services are often based on information preferences expressed in advance. This is called a publish/subscribe model. A client might "subscribe" to various information "channels". Whenever new content is available on one of those channels, the server would push that information out to the user. For Example: the “Mobile Network location” displayed on your mobile, which keeps on changing based on the tower you are connected.

Push notification allows an application to notify you of new messages or events without the need to actually open the application, similar to how a text message will make a sound and pop up on your screen. This is a great way for apps to interact with us in the background, whether it be a game notifying us of some event occurring in our game world or simply the iPad’s mail application beeping as a new message appears in our inbox.

In addition to pushing messages to the screen, push notification allows apps to display a number or ‘badge’ on the app’s icon. For example, the Mail icon will show the number four when we have four unread messages.

The Apple Push Notification Service is a mobile service created by Apple Inc. that was released with iOS 3.0 on June 17, 2009. It uses push technology through a constantly-open IP connection to forward notifications from the servers of third party applications to the iPhone, iPod Touch and iPad; such notifications may include badges, sounds or custom text alerts.

This is a small information quoted from Apple

Apple Push Notification Service requires iOS 3.0 or later and a connection to the Internet, either via a cellular data network or Wi-Fi, and at least one application that supports notifications.

  • If the Settings > Notifications menu does not appear on your device, you don’t have an application installed that supports notifications.
  • You need to open an application at least once to get any notifications from that app.
  • When the iPod touch screen is on and has a Wi-Fi connection, push notifications are received at any time. If the iPod touch screen is asleep, it will check every 15 minutes for a notification.
  • If you want to disable notifications from an application, turn off all notifications for that application in Settings > Notifications.
  • When you restore a backup to a different iPhone or iPod touch, apps will need to be opened again to get notifications.
  • If the device is connected over Wi-Fi and is still unable to receive notifications, the Wi-Fi network you’re using might have a firewall that is blocking port 5223. This port must be open to TCP traffic for notifications to work.

Few days before writing this article I was in an assumption that since iOS is a closed platform, we cannot utilize other java/.NET server components to make calls to Apple Push notifications API. But recent explorations I figured out we can send out push notifications with help of .NET Library (APNS Sharp), read more on my previous article Sending Apple iOS Push notifications using C# . I successfully tested this in iPhone 3G, by sending push notifications from a .NET application.

 

Apple has provided two gateway interfaces, one for development/sandbox and another for production use.

Production environment is available through gateway.push.apple.com, port 2195 ; the binary interface of the sandbox (development) environment is available through gateway.sandbox.push.apple.com, port 2195.

.. keep reading more on Local and Push Notification Programming Guide

 

Quick Note: Make sure your port 2195 is not blocked by your firewall, incase you are getting issues.

Other times, you're doing some piece of work and suddenly you get feedback that tells you that you have touched something that is very alive in the cosmos. Share your feedback on this blog, it will help me improve it a lot..