Monday, July 4, 2011

UILocalNotification Description

Instances of UILocalNotification represent notifications that an application can schedule for presentation to its users at specific dates and times. The operating system is responsible for delivering the notification at the proper time; the application does not have to be running for this to happen. Local notifications are primarily intended for applications with timer-based behaviors and simple calendar or to-do list applications.

When you create a local notification, you must specify when the system should deliver the notification. You can do this with the help of a property called as the “fire date” along with another property called as “timeZone” so that the fire date is adjusted when time-zone changes occur. You can also specify a repeat interval (daily, weekly, monthly, and so on). The substance of the notification can be an alert message or an application-icon badge number; you can also request that sound be played when alert messages are displayed.

Once you have created an instance of UILocalNotification, you schedule it using one of two methods of the UIApplication class: scheduleLocalNotification: or presentLocalNotificationNow:. The former method use the fire date to schedule delivery; the latter method presents the notification immediately, regardless of the value of fireDate. You can cancel specific or all local notifications by calling cancelLocalNotification: or cancelAllLocalNotifications, respectively.

When the system delivers a local notification, several things can happen, depending on the application state and the type of notification. If the application is not frontmost and visible, the system displays the alert message, badges the application, and plays a sound—whatever is specified in the notification. If the application is foremost and visible when the system delivers the notification, no alert is shown, no icon is badged, and no sound is played. However, the application:didReceiveLocalNotification: is called if the application delegate implements it.

The above was just a brief on UILocalNotification in my next post I will show you how to work with this class and display your first local notification.  

No comments:

Post a Comment