4/14/2015 - 12:48 AM

Local Notifcation in a VC

Local Notifcation in a VC

Adding a Local Notification
	• The reminder feature will use a local notification 
	• A local notification is a way to notify the user when  the user is not running the app
	• Also there is =push notifications that are implemented using a backend server.  This is good if data needs to update in the view especially.   See also push notifications app documentation
	• Displaying a local notification is easy
		○ Create a UILocalNotification and give it a text and date 
		○ Schedule the notification with the shared application -- the single instance of UIApplication
	BNRReminderViewController.m addReminder()
	Add a notification to anything that might require a notification to be in place if the user minimizes, closes the app etc..  e.g.,  A timer in the background etc.  
		○ Testing :  Application does not need to be in the foreground.  Press Home button on device or select Hardware>>Home .  When the time selected is reached, a notifcation banner should appear at the top of the screen.  
			§ Also test selecting the notification that should lauch the Hyponerd application.  

One Problem That should be addressed shrtly :  User can select a time in the past…


	- (IBAction)addReminder:(id)sender 
	        NSDate *date =;
	        NSLog(@"Setting a reminder for the %@", date);
	        //create a instance of UILocalNotification 
	        UILocalNotification *note = [[UILocalNotification alloc] init];  
	        note.alertBody = @"Hypnottize me!"; 
	        note.fireDate = date;  
	        [[UIApplication sharedApplication] scheduleLocalNotification:note];