Question

I am developing an alarm clock application in iphone. I am not able to find how to set alarm which will trigger even if the app is not running. Please suggest me some code or tutorial to do it.

Thanks in advance.

Was it helpful?

Solution

Push notifications... OR....

The other day I noticed that if I turned off the screen (with the button on the top) that my app was still getting gps updates....

So, I'm starting to think that just hitting the top button doesn't actually exit your app... You'd need to do some experiments to prove this... but maybe you could still play a sound with the screen off?

OTHER TIPS

Local notifications!

(This is now the correct answer since iOS 4.0 so gimme the credits!! (jk))

There really is no good, clean solution at the moment. The best that I've been able to find is a class (http://code.google.com/p/iphone-insomnia/) that stops it from sleeping. With this running, you can do whatever you want, but it will most likely drain the battery quite fast.

One other half solution is that the iphone doesn't sleep if it is charging. So you could simply alert your users that the alarm will only work if the iPhone is charging before it is set and that they cannot leave the app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top