How to set up an alarm using UIDatePicker?

I am developing an alarm clock application in iphone. I cannot find how to set an alarm that will go off even if the app is not running. Please suggest me some code or tutorial to do this.

Thanks in advance.

+2


source to share


3 answers


Push notifications ... OR ....

I noticed the other day that if I turn off the screen (with the button at the top) that my app is still receiving gps updates ....



So I'm starting to think that just clicking on the top button doesn't actually exit your app ... You will need to do some experimentation to prove it ... but perhaps you could still play sound with the screen off?

+1


source


Local notifications!



(This is now the correct answer as of iOS 4.0, so give credits !! (jk))

+2


source


There really isn't a good, clean solution at this point. The best I could find is the class ( http://code.google.com/p/iphone-insomnia/ ) that keeps it from sleeping. With this startup, you can do whatever you want, but it will likely drain the battery pretty quickly.

Another half of the solution is that the iphone is awake if it is charging. This way, you can simply warn your users that the alarm will only work if the iPhone is charging before installing it and that they cannot leave the app.

0


source







All Articles