Search Posts in my Blog

Friday 2 March 2012

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: orcancelAllLocalNotifications, 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. 

2 comments:

  1. in my app the user given a date through uidatepicker for getting notification on that particular date. it works fine. suppose the user need to change the date of notification which is already entered how can i write the code for iPhone. please tell me a way to slove this.

    ReplyDelete
    Replies
    1. Hi,
      As you say, I can understand that the user is given a DatePicker for getting notification. And if the user wants to change the notification then the user can user the same datepicker to set new notification and set that value to ur UINotification object.. iHope i have understood and answered u correctly.
      Appy Coding...

      Delete