I am trying to add a built-in alarm function to the application that I am developing.
I read the UILocalNotification
object and its use, and I know that it is limited to 30 seconds of audio.
I was thinking of planning several notifications (say 5 of them) located 30 seconds apart to simulate a continuous game, but the problem with this approach is that if the user clicks Close
, I will not be able to cancel any of the subsequent notifications.
As far as I know, it is impossible to remove or hide the Close
button without hiding the notification completely (i.e. set the alertBody
property to Nil
).
So, I thought I could use the repeatInterval
property to trigger a notification every 30 seconds, but it seems that I can set the interval to only one minute or one second, and there was nothing between them.
The function is designed so that the user can choose between music and sound signals for an audible alarm; I seem to have found a way to make beeps - by setting repeatInterval
for one second, create a second beep (which should be designed for pure repetition) and use this as a notification sound.
However, for music, this approach limits me to playing 30 seconds of audio, followed by a 30 second gap, followed by 30 seconds of audio, etc.
I know that there is no simple solution from my reading of other messages and resources; no third-party application has access to the same functions as the built-in alarm clock. I hope someone has found a workaround or is thinking of something really smart.
UPDATE: I found that repeatInterval
does not help me in this case, since I cannot cancel repeats without starting the application.
Currently, I decided not to use the notification as an alarm as such, but changed this function as a reminder (more on the lines for what the notification is intended).
If I come up with a way to use the convenient and reliable alarm functions for the application, I will update this message.