1

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?

E_net4
  • 27,810
  • 13
  • 101
  • 139
Mr.G
  • 1,275
  • 1
  • 18
  • 48
  • 1
    look into this http://stackoverflow.com/questions/9725192/how-do-i-start-playing-audio-when-in-silent-mode-locked-in-ios-6 – Gagan_iOS Jan 18 '16 at 10:31
  • already tried but this doesnt work , have you implement this before – Mr.G Jan 18 '16 at 10:36
  • 1
    Thankfully, you can't. If the phone is on silent, iOS will respect that, even if you don't want it to. – Avi Jan 18 '16 at 10:41
  • i have the same concern but , i guess this app does that https://itunes.apple.com/ca/app/step-out-bed!-smart-alarm/id673120263?mt=8 – Mr.G Jan 18 '16 at 10:48
  • You simply can not build alarm app for iPhone. Alarm has to be precise on time, and iOS does not guarantee your local notifications to be firing on exact date that you scheduled. They may fire when system is okay with that. And you can not play any sound while iPhone is on silent mode. – Eugene Dudnyk Feb 05 '19 at 13:59

0 Answers0