Prevent Screensaver from Playing in App

Anyone know how to prevent the screen savers from playing while your tvOS app is running?


Thanks

Felix

Answered by halm in 58497022

Based on my very brief test, it appears that UIApplication's "idleTimerDisabled = true" will do that. I tried this in AppDelegate, and the screen saver has yet to fire, although it's now several multiples over the timeout setting:


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {

application.idleTimerDisabled = true

return true

}

Accepted Answer

Based on my very brief test, it appears that UIApplication's "idleTimerDisabled = true" will do that. I tried this in AppDelegate, and the screen saver has yet to fire, although it's now several multiples over the timeout setting:


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {

application.idleTimerDisabled = true

return true

}

Thank you

In my testing, this will stop the screensaver from displaying, but will also stop the screen from going to sleep. For our app, we only need to stop the screensaver, but we don't want to stop the screen from going to sleep.

For example, a user can set the screensaver for 15 min, but set the screen to sleep after 4 hours. For our app, we want to stop the screensaver, but still allow a user to have the screen to sleep after that 4 hours.

Is there a way to only disable the screensaver, but do not stop the screen from sleeping?

Prevent Screensaver from Playing in App
 
 
Q