concept push notification in category ios

This is an excerpt from Manning's book iOS 7 in Action.
Push notifications are the solution for these issues; they’re a great way for apps to interact with users at any time. When an event of interest occurs, you send a specially crafted message to a user’s device, and they’ll see a message and hear an alert. This is similar to what happens when you get an SMS or a new email on your iPhone.
In this chapter you’ll learn how push notifications take place. You’ll learn how to configure your app to accept push notifications and how to send them. At the end of the chapter you’ll have the tools to interact with your users, even when they aren’t using your application. You’ll create a simple application called SaleAlerts, which alerts the user to new offers using push notifications, as shown in figure 13.1.

This is an excerpt from Manning's book iOS in Practice.
Push notification is a way to have a server send a message to a device. The message can include text, a badge number for the specified app’s icon, and an audio file included in the app to play.
Push notification is a big way for an app to live outside of itself. While many apps have a server-side portion, it’s often in support of the app’s use by the user. The server side can be for queries of a database, storing data, or downloading content.
Push notifications allow the app (as the server side) to work even when it’s not running. Reminders, updates, and messages are examples of how the app can be effective even when it’s not running.
There are various ways to develop the functionality necessary to create push notifications that are pushed to devices through Apple servers. UrbanAirship has an easy-to-use process to facilitate push notifications, and you’ll use it in this technique.
Through this technique, you’ll see how to provision the app for push notifications on the Apple site as well as the UrbanAirship site, and look at how the two are related. From there, you have the necessary configuration pieces in place, and you can code the app to send and handle push notifications. The code for push notifications in the app is relatively insignificant work compared to the configuration.

This is an excerpt from Manning's book iOS 4 in Action: Developing iPhone and iPad Apps.
Let’s review a bit of history on iOS. The iOS SDK was first introduced in 2007 and released in March of 2008. The third major release, iOS 3.0, was released in 2009. Prior to iOS 4.2, there was a short, fragmented OS history on the iPhone and iPad; the iPhone was running on iOS 4.0 and the iPad was on iOS 3.2. With the new iOS, all the iOS-powered devices can once again run the same OS. For developers, the experience for application development is a lot smoother and easier. The most prominent feature on iOS 4 is that iOS supports multitasking services, including playing audio, push notifications, receiving location change events, and fast app switching. We’ll cover the details later in this book.
Push notification is a notification sent remotely by Apple’s Push Notification service to the device that your application is running on. A classic example of the problem of presenting the user with real-time data updates is an instant messenger program. Instant messaging allows users to send quick chat messages to their contacts who are online.
Push notifications rely on one specific service provided by Apple. This service is called Apple Push Notification Service (APNS). APNS is a web service that every provider must communicate with in order to send notifications to a client device. Devices establish a connection to this service and receive messages from it when they’re available. If a device isn’t running the application that received the notification, it’s prompted with an alert window containing information pertaining to the state of the application. Figure 17.4 shows the complete cycle of a push notification that we’ll discuss in this section.
Push notifications originate in what Apple calls the push notification provider. The provider is a server created by the developer of an application. These providers are often used in conjunction with applications that depend on the web to get new data to use.
As we mentioned earlier, the code to handle push notifications is simple. You need to implement only three methods. We’ll walk through each of these methods and discuss their use.
The first method is application:didFinishLaunchingWithOptions:. This method is already implemented for you in any application that you create. You need to add one line of code that tells your application to register for push notifications. The following code shows you how to do this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions [[UIApplication sharedApplication] registerForRemoteNotificationTypes:( UIRemoteNotificationTypeAlert |UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; }As you may have seen, your application will have other setup tasks in this method; we just wanted to show you the line of code that must be added to register for push notifications. This code tells the device that this application wants to receive push notifications in the form of alerts, badge numbers, and sounds. You can omit any of these properties if you choose not to send them.
You may wonder why you must do this more than once. The reason is that the token generated when you set up push notifications isn’t guaranteed to be the same. You must touch base with Apple every time the application launches, to make sure everything is correct to receive notifications.

This is an excerpt from Manning's book iPhone and iPad in Action: Introduction to SDK Development.
As mobile devices become more popular, developers must face new and exciting challenges. One of these major challenges has been around since the dawn of mobile software. It’s related to background processes. What is the best way to update application data without the user explicitly running the application? Push notifications are Apples’s solution. In this chapter we’ll look at Apple’s push notification system, how to prepare an application to work with push notifications, and how to create a notification provider on a server. First though, let’s examine what exactly push notifications are.
On the iPhone and iPad, only applications created by Apple have the ability to run in the background. Some of these applications include Mail, Phone, and Safari. Up until the iPhone OS 3.0, applications had no way of notifying the user of new information without them being run by the user. The elegant solution that Apple came up with is called a push notification.
A push notification is a simple message that originates at a push provider, containing information related to a specific program. These messages can contain any number of things, including a message, a sound file to play, a badge count, and any custom key-value pair needed for an application. Figure 16.1 shows an example of what a push notification might look like for an application.
As you can see in the figure, the push notification looks similar to a text message. It contains a title, a message, and two buttons. The title is the title of the application that the push notification is related to.
When the user taps the View button, the iPhone opens the application that invoked the push notification. In this case, a program called pushtest is launched. In addition to showing this message, the badge number of the pushtest icon is set to the number 2, as shown in figure 16.2.
As we mentioned earlier, the code to handle push notifications is simple. You need to implement only three methods. We’ll walk through each of these methods and discuss their use.
The first method is applicationDidFinishLaunching:. This method is already implemented for you in any application that you create. You need to add one line of code that tells your application to register for push notifications. The following code shows you how to do this:
- (void)applicationDidFinishLaunching:(UIApplication *)app {
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:( UIRemoteNotificationTypeAlert
|UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
}As you may have seen, your application will have other setup tasks in this method; we just wanted to show you the line of code that must be added to register for push notifications. This code tells the device that this application wants to receive push notifications in the form of alerts, badge numbers, and sounds. You can omit any of these properties if you choose not to send them.
You may wonder why you must do this more than once. The reason is that the token generated when you set up push notifications isn’t guaranteed to be the same. You must touch base with Apple every time the application launches, to make sure everything is correct to receive notifications.