I need to create an alarm app, which has capability to play sounds while phone is in silent mode.
According to this, it is possible with AVAudioSession
but my problem is how to connect this with UILocalNotification
:
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.fireDate = fireDate;
notification.alertBody = @"Time to wakeup";
notification.soundName =UILocalNotificationDefaultSoundName;
// notification.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
[self presentMessage:@"Alarm shedule complete"];
Is there any other way to do this?
I have already tried the following link, but it does not work as they have mentioned: How do I start playing audio when in silent mode & locked in iOS 6?