Iam doing one application/In that i want to get the notification when the application is in sleep mode.First it check the condition if condition is satisfied then notiofication will rise.So for this,my code is
if ((f >= [babycrydefault floatForKey:@"keyToSlidervalue"])) {
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.timeZone = [NSTimeZone defaultTimeZone];
localNotif.soundName = @"baby_cry-1.wav";
localNotif.alertLaunchImage=@"baby.png";
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
[localNotif release];
}
when iam using this code iam not getting any notification.So please inform me if therer is any errors.
First thing: I don’t think you want the code to execute while your app in the background 🙂 The code won’t execute even if you want it to do.
Second thing: If you don’t set the
fireDatethe notification will be fired immediately. And if the notification fires while your app is running, the alert will not be displayed. Just theapplication:didReceiveLocalNotification:method in your app delegate will be triggred.