5

I've been building the past few days a custom alarm clock for Android. So far so good, the alarm fires and I play some remote sound using HTTP streaming (network is of course needed, or else, there is a fallback with local sound). Now it's time take this app to iOS, I'm a total beginner but I'm not afraid to learn Objective-C since the client part is really straightforward. But from what I see, it seems to me it's quite impossible. I would like some help here if possible :

  • In the iOS developers docs I see this "For remote notifications in iOS, you can specify a custom sound that iOS plays when it presents a local or remote notification for an application. The sound files must be in the main bundle of the client application.". This is bad for me, I would like to play 1 to many sounds following each other and for possibly more than 30 seconds. Is there a work around for this?
  • In another question I see "They could be background-capable audio apps (using UIBackgroundModes in the app's plist) and playing silence, using Audio Queues or the RemoteIO Audio Unit, even in the background, until time to mix in some alarm sounds or music.", but someone after that, says AppStore validation doesn't allow that. Is this still accurate?
  • In a general question, is it possible, nowadays (or in a near futur iOS version), to do a simple alarm clock that is able to play remote sounds with no restrictions?

I would appreciate any feedback here, I'm quite disappointed from what I see that this simple feature seems to be impossible to do. Unless I'm mistaken somewhere and I hope someone will give me a hint!

Thx for reading!

Battochon
  • 61
  • 3
  • you could download the sounds locally before you need them - eg. check for new sounds and download them at app start and them execute them from your documents directory. – PRNDL Development Studios Mar 15 '13 at 16:09
  • Thx a lot for your answer! But the docs say "The sound files must be in the main bundle of the client application", is it possible to play in an alert a sound file that has not been shipped with the application (but downloaded somewhere in the phone)? If yes, then I can do something still do something I guess. – Battochon Mar 15 '13 at 16:20
  • Check out this link: http://stackoverflow.com/questions/10245345/how-to-download-audio-video-files-from-internet-and-store-in-iphone-app – PRNDL Development Studios Mar 15 '13 at 16:22
  • Install a custom ringtone and call the phone? – Hot Licks Mar 15 '13 at 17:05
  • as far as i know, you can't play back downloaded files through notifications - you'd need to add them to the (read-only?) bundle, which would break the bundle signature. – Martin Ullrich Mar 28 '13 at 16:15
  • All the "workarounds" mentioned here (audio app, keeping the app alive,..) would make a really BAD user experience so even if it passes apple's validation, people probably won't use it very long. Apple recently ported its Clock app to iPad with iOS 6 - before, there was no "working" (background, muted) alarm clock app - just have a look at the ratings of those apps calling themselves alarm clock – Martin Ullrich Mar 28 '13 at 16:18

1 Answers1

2

I see no way around this since Apple doesn't allow launching apps without user interaction. Although you can change the workflow so that user has to keep the app running (screen can still be locked) for the alarm to work. This is how other alarm apps work.

I suspect the 2nd solution you mentioned wont go well with Apple because it'll drain user's battery. You are taking cpu cycles while not doing anything (playing silence).

maroux
  • 3,764
  • 3
  • 23
  • 32