How to Prevent iPod Touch from Touching Sleep

I am creating an ipod touch application that needs to be run several times (e.g. alarm clock). I would like iPod touch to stay awake if manual use doesn't exit the app. Is this possible with the current SDK?

+6
iphone ipod touch
source share
2 answers

You can disable sleep mode:

[[UIApplication sharedApplication] setIdleTimerDisabled:YES]; 
+18
source share

As Harrison says ...

But check out what Apple has to say about it here: iPhone Programming Guide

For your use case, I think you should consider dimming the screen after a few seconds to minimize energy consumption. Also, if it’s an alarm so that it doesn’t wake up all night :)

-one
source share

All Articles