简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM