Android Question Wake state and timers

Discussion in 'Android Questions' started by nibbo, Jul 28, 2015.

  1. nibbo

    nibbo Active Member Licensed User

    OK, it seems that timers stop when tablets 'go to sleep'; i.e. the display timeout is reached.
    I can use the PhoneWakeState to keep it alive but this will cause battery drain due to keeping the screen on all of the time albeit dimmed.
    Is there a way to keep the process running but allow the screen to switch off thus keeping timers running without reducing battery time?
    I thought that was what partial lock was for but this too seems to keep the screen on but dimmed.

    Out of curiosity; what is the difference between PartialLock and KeepAlive(False)?

    Thanks
     
    Last edited: Jul 28, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    PartialLock will not prevent the screen from turning off and will keep the cpu running.
     
  3. nibbo

    nibbo Active Member Licensed User

    Thanks for the reply Erel,
    That is what I thought, however, when trying partial lock the screen is still on but dimmed and never goes completely blank.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Make sure that there isn't any other call to PhoneWakeState.

    This is how this API should work.
     
  5. nibbo

    nibbo Active Member Licensed User

    Hi again Erel, apologies for taking so long to confirm this but got dragged onto another project.
    I have searched through the entire app and the only PhoneWakeState's I can find are PartialLock never KeepAlive but still the tablet stays awake but dimmed.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

  7. nibbo

    nibbo Active Member Licensed User

    All a bit strange.
    I tried the same app on a Motorola Xoom a galaxy tab2, 3 & 4 using the PartialLock option.
    The xoom, tab 2 & tab 4 all went to sleep and the timer operation stopped.
    The tab 3 keeps going but the dimmed screen stays on.
    Also wrote a little test for a galaxy s5 phone and the screen stays on in dimmed mode.
     
Loading...