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?
Asked
Active
Viewed 1,975 times
6
-
check this link...http://cocoabugs.blogspot.com/2010/10/how-to-aviod-application-going-to-sleep.html – Oct 23 '10 at 04:32
2 Answers
18
You can disable the sleep mode:
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];

kharrison
- 3,412
- 1
- 24
- 19
-
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 Mar 30 '10 at 13:16
-1
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
- 11,380
- 13
- 81
- 120