Search Posts in my Blog

Showing posts with label notification iphone. Show all posts
Showing posts with label notification iphone. Show all posts

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. 

Thursday, 1 March 2012

Notification Concept



What is notification: Notifications are alerts that are displayed by your mobiles to notify you that something has happened like when you get an sms or when you receive a mail at that moment you receive a notification by your mobile indicating that you have received a mail or message. In the iphone you have the UILocalNotification and the UIPushNotification which are very popular methodology to notify the user.


UILocalNotification: The UILocalNotification is more like a local notification example your schedulers, alarms etc, it gets triggered on a specified date or time, when you are coding for the UILocalNotification you must specify when the system should deliver the notification, also if you want to get the notification daily that’s on repeated basis then this can also be done via code.
UIPushNotification: 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.

And there is one more notification that I call it as the within the app notification mostly to receive the notification you must have a listener and a broadcaster with the listener getting the memory first as it will be receiving the messages from the broadcaster. For example you will explain working of a computer to the one having ears and not to a deaf person because in order to understand working of a computer the person should have ears so that he can process the information. In this case we will call the ears as listeners and the person explaining the working of a computer as a broadcaster.
  
Apple sdk has a class called as the NSNotificationCenter this class provides a mechanism for broadcasting information within a program, first you register a notification in the notification dispatch table with a proper name and you will use this name to perform the task of your choice like displaying pop ups or something else. There is another method of the NSNotificationCenter called as the addObserver:selector:name:object: with the help of which object register themselves as observers for a particular notification so in a nutshell the sender or the broadcaster posts a notification by sending an object to the NSNotiifcationCenter, the notification center then notifies to the observer or listener who is observing this notification.

Summary: A notification center manages the sending and receiving of notifications. It notifies all observers of notifications meeting specific criteria. The notification information is encapsulated in NSNotificationobjects. Client objects register themselves with the notification center as observers of specific notifications posted by other objects. When an event occurs, an object posts an appropriate notification to the notification center. 

i hope that this post was helpful in my next post i will show you how to display a simple notification