BeachRunnerFred BeachRunnerFred - 1 year ago 66
iOS Question

How can I prevent the display on an iOS device from dimming and turning off?

I'm diving into iOS development and am building my own alarm clock app to become familiar with platform and SDK. I've noticed some alarm clock apps in the app store keep the screen from dimming and/or turning off when their app is running. How is this implemented?

Thanks so much in advance for all your help!

Answer Source

Add this line of code on your application delegate:


[[UIApplication sharedApplication] setIdleTimerDisabled:YES];


UIApplication.sharedApplication().idleTimerDisabled = true
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download