I would write as much as I could write here, but the title pretty much says it all. I tested it in several different situations:
1) The phone is on, silence is turned off, the application is on, in the foreground, the screen is unlocked
I know this happens through the delegate of the didReceiveLocalNotification application and did not expect sound or vibration, except for the processing code that I included in didReceiveLocalNotification. Processing code actually called
NSURL *Sound = [[NSBundle mainBundle] URLForResource: self.currentSoundPVC withExtension: @"caf"];
and it really works! It reproduces sound and vibrates the phone at the same time.
2) the phone is on, silence is turned off, the application is on, in the background, the screen is unlocked
Now I have configured my uilocalnotification avatars in the application delegation application applicationDidEnterBackground using the following code
NSString *Sound = [self.currentSoundPVC stringByAppendingString:@".caf"]; UILocalNotification* alarm = [[[UILocalNotification alloc] init] autorelease]; alarm.fireDate = [NSDate dateWithTimeIntervalSinceNow:seconds]; [alarm setSoundName:Sound]; [[UIApplication sharedApplication] scheduleLocalNotification:alarm];
and it only partially works! The sound is playing, but there is NO VIBRATION! Now, I think this is a mistake, because I am quoting from the Apple developer website
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html , "Planning the delivery of local notifications":
"When a notification is sent and sound is played, the system also vibrates on devices that support it."
Now, obviously, this IS NOT a MATTER for my iPhone, and obviously the simulator does not vibrate, so I can’t check it and would like it to be considered in the developer community!
3) the phone is on, silence is turned off, the application is on, in the foreground, locked on the screen
Same as # 2
4) the phone is on, silence is turned off, the application is on, in the background, locked on the screen
Same as # 2
5) the phone is turned on, silence is turned off, the application is turned off (the background process is deleted)
Same as # 2 because uilocalnotifications have never been canceled, so iOS still thinks they are valid.
6) the phone is on, the mute mode is on, the application is on, in the background, the screen is unlocked
no sound, vibration, NOTHING! This sucks! I would hope that the apple comes up with something that works right out of the box, as usual!