4

I did a lot of research and couldn't find a proper solution for my problem. I want to make an iPhone app that plays a custom sound even when it is in background at a certain time (alarm clock app). I did a research on the following points:

  • Local Notification -> no sound longer than 30 seconds allowed
  • Background Audio -> Apple refuses Apps that don't continuously run music in background, also there is no way to trigger sound when receiving a local notification

Is there any way to achieve this, i mean there has to be one.. i found dozens of apps in the app store that support playing sounds from your library even in background, and not only 30 seconds long (this one for instance: https://itunes.apple.com/us/app/background-alarm-clock-free/id723243753?mt=8)

If possible in swift.

iVentis
  • 993
  • 6
  • 19
  • It's objective-c, but this answer appears to address your issues: http://stackoverflow.com/questions/22591421/ios-background-audio-not-playing – Vince O'Sullivan Jan 28 '15 at 10:00
  • hm.. not exactly.. it's not shown how to trigger it from the background when a notification fires (or similar) – iVentis Jan 28 '15 at 10:37
  • @iVentis did u find a solution to this , to play music in background when alarm pop comes up – Mr.G Jan 27 '16 at 08:28
  • @Mr.G unfortunately not, in the end i did it with a 30 seconds alarm.. there seems to be no other way instead of this: http://oleb.net/blog/2014/02/alarm-clock-apps-ios/ – iVentis Jan 27 '16 at 10:51
  • @iVentis i was trying to run the alarm tone when the app is in the background, were u able to do it ? – Mr.G Jan 27 '16 at 11:11
  • @Mr.G no, as i said.. in the end i went with the 30 seconds sound of the notification itself.. the only way to fire the sound in the "backround" (at least that i found) is this: http://oleb.net/blog/2014/02/alarm-clock-apps-ios/ – iVentis Jan 27 '16 at 11:38
  • but if u can take a look about this app, https://itunes.apple.com/us/app/step-out-bed!-smart-alarm/id673120263?mt=8 this has the capability to run in background mode , but only if the app is in the background , and sometimes it works sometimes, it doesnt , i think they are firing this using beginBackgroundTaskWithExpirationHandler – Mr.G Jan 27 '16 at 12:14

0 Answers0