Prevent Power Save


is there a way to prevent my iOS App not to allow the device to go into power save (screen dim)?

Thanks, Marco

Yes, like this:

   Declare Sub setIdleTimerDisabled Lib "UIKit" selector "setIdleTimerDisabled:" _
   (app_id As ptr, value As Boolean)
   declare function NSClassFromString lib "Foundation" (clsName as CFStringRef) as ptr
   declare function sharedApplication lib "UIKit" selector "sharedApplication" (clsRef as ptr) as ptr
   Var app_id As ptr = sharedApplication(NSClassFromString("UIApplication"))

   setIdleTimerDisabled(app_id, True)

thank you, Jeremie!

1 Like