iosidle-timer

How to change idle timer delay time in iOS


Is there any way to change time after which idle timer will dim the sceen? I would like to set it in my app, for instance to 5 seconds of no user interaction.


Solution

  • The "idle timer" which invokes the lock screen is not configurable from within the application. It is the users' discretion how much time to set for the lock screen to kick in. You can probably acquire some hacks to invoke that using private APIs but Apple wouldn't like that.

    There are ways to disable idle timer of course:

    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
    

    Note


    Important: You should set this property only if necessary and should be sure to reset it to NO when the need no longer exists. Most apps should let the system turn off the screen when the idle timer elapses. This includes audio apps. With appropriate use of Audio Session Services, playback and recording proceed uninterrupted when the screen turns off. The only apps that should disable the idle timer are mapping apps, games, or similar programs with sporadic user interaction.