Search code examples
iostimerscreenscreensaver

iOS and timer app: is there a way to prevent screensaver to start?


Possible Duplicate:
How do I prevent the iPhone screen from dimming or turning off while my application is running?

I am working on a timer app and was wondering if there is a way to tell iOS not to start the screensaver when the app is idle (e.g. timer laying on the table).

I would also like to keep the screen brightness at maximum level.

Any suggestion?


Solution

  • For disabling the screensaver, try this:

    [UIApplication sharedApplication].idleTimerDisabled = YES;
    

    For adjusting the brightness of the screen (iOS5 and later only, previously there was no public API for this):

    [[UIScreen mainScreen] setBrightness:1.0];