I am building an application for the ipod touch that needs to run for several time (like an alarm clock). I would like to prevent the ipod touch from going to sleep unless the use manually exit the application. Is this possible with the current SDK?
+6
A:
You can disable the sleep mode:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
kharrison
2010-03-30 08:54:18
This one is right but "sometimes" , I noticed that it does not work (even with such settings, the iphone goes to idle :/) . It's not 100% reproducable, I don't know in which cases it occurs (I was on 3.0 when I noticed that), but if someone has also noticed that and if there's a known way to work around it... :/
yonel
2010-03-30 13:16:31
A:
As kharrison says...
But read-up on what Apple has to say about it here: iPhone Application Programming Guide
For your use-case I think you should consider dimming the screen after a few seconds to minimize power consumption. Also if it is an alarm clock, not to keep the user awake all night:)
RickiG
2010-03-30 12:31:54