Search Posts in my Blog

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

No comments:

Post a Comment