How to prevent Ipod Touch Application from going to sleep
Asked Answered
S

2

6

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?

Suzannsuzanna answered 30/3, 2010 at 8:44 Comment(1)
check this link...cocoabugs.blogspot.com/2010/10/…Disfeature
W
18

You can disable the sleep mode:

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
Wailoo answered 30/3, 2010 at 8:54 Comment(1)
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... :/Beluga
S
-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:)

Stern answered 30/3, 2010 at 12:31 Comment(1)
Apple does not allow you to dim the screen.Faustinafaustine

© 2022 - 2024 — McMap. All rights reserved.