Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is possible to play an alarm in iOS if the application is closed?

I downloaded some Alarm Clock apps from the App Store and found they are able to keep playing a sound and even vibrating the phone for more than 30 seconds (Limitations from UILocalNotifications) I even forced to close the application and it still work!

I wonder how is this possible? Is there another method than UILocalNotification ? Are they using several notifications?

Thanks!

like image 777
RubenVot Avatar asked May 06 '12 01:05

RubenVot


2 Answers

I believe that if you schedule a UILocalNotification, the OS takes control of the notification and will execute it even when the application that scheduled it closes.

like image 110
LJ Wilson Avatar answered Sep 22 '22 12:09

LJ Wilson


They could be using Push Notifications, but that would require an external server, internet, and is unlikely.

What is more likely is that they are just using UILocalNotifications. When you schedule one to go off at a specific time, it will go off at that time even if the app has been quit. The OS will direct all Local Notifications once they have been scheduled. Here's the Apple documentation on UILocalNotification.

EDIT: In response to your comment, scheduling one Local Notification, followed by scheduling a second one for 30 seconds later, and so on, is plausible. And to me, it seems like the only way if there is a 30 second restriction.

like image 41
dgund Avatar answered Sep 22 '22 12:09

dgund