Reputation: 1103
I have the following code implemented in applicationDidEnterBackground:
-(void)applicationDidEnterBackground:(UIApplication *)application
{
// Fire date is set to 30 secs and repeat interval is set to 1 min
// for testing purpose.
localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:30];
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = @"Test Notification";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.repeatInterval = NSMinuteCalendarUnit;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}
The variable localNotification is initialised in application:didFinishLaunchingWithOptions.
All local notifications are cancelled in applicationDidBecomeActive.
Steps:
1) The app Notification Center is initially On when the app is put into background by the user hitting the HOME button.
2) Notification shows up accordingly.
3) Turn app Notification Center to Off in Settings.
4) Notification still shows up.
Notification will be not shown if the app Notification Center is turned off. Is this correct? If my assumption is wrong, how can I cancel the notification when the user turns off the app Notification Center. Deployment target is iOS5.1. iPhone is running iOS6.1.
Upvotes: 0
Views: 351
Reputation: 9533
I’m not sure I understand you, but when you pull an app out of notification center it stops showing it in the notification center window, but it’ll still show the banner or alert on the screen unless you turn that off as well.
Upvotes: 1