Proper way to handle idleTimerDisabled

Discussion in 'iOS Programming' started by idelovski, Nov 2, 2010.

  1. idelovski macrumors regular

    Joined:
    Sep 11, 2008
    #1
    I have one place in my app where screen should not get dimmed even if user does not touch things for a while.

    I am turning this on in -viewDidAppear: and off in -viewWillDisappear: plus in -applicationWillTerminate: of application delegate. This is what I have in the delegate:

    Code:
       if (app.isIdleTimerDisabled)
          app.idleTimerDisabled = NO;
    
    What about other places? If my application goes to the background, is system handling this or I need to turn this off in -applicationDidEnterBackground: or -applicationWillResignActive:? Any other places?
     
  2. ianray macrumors 6502

    Joined:
    Jun 22, 2010
    Location:
    @
    #2
    In my App I set idleTimerDisabled when the GPS (Location Services) is switched on, and clear it when the GPS is switched off. This appears to be sufficient.

    In other words, the system takes care of the Idle Timer when your App is not in the foreground.
     
  3. idelovski thread starter macrumors regular

    Joined:
    Sep 11, 2008
    #3
    Thanks,

    I looked again at the documentation and it states that "You should set this property only if necessary and should be sure to reset it to NO when the need no longer exists."

    I suppose it means that I should turn it off when my application doesn't need it any more and not when the device in general doesn't need it any more. I think I worry too much about these things.
     

Share This Page