in alarm ,notification works fine in background as follows:
UILocalNotification *notification1=[[UILocalNotification alloc]init];
notification1.fireD
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 UILocalNotification instance is passed into this method, and the delegate can check its properties or access any custom data from the userInfo dictionary.
In foreground you have to provide alert view and play sound if it requires, the notification will just call applicationDidReceiveLocalNotification. You can play the sound using AVAudioPlayer
//Playing sound
NSURL *url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath],notification.soundName]];
AVAudioPlayer *newAudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL];
self.audioPlayer = newAudioPlayer;
self.audioPlayer.numberOfLoops = -1;
[self.audioPlayer play];
[newAudioPlayer release];