Android Question [CLOSED] Get the current PhoneWakeState ?

Discussion in 'Android Questions' started by lemonisdead, Feb 18, 2015.

  1. lemonisdead

    lemonisdead Well-Known Member Licensed User

    Hello,
    Do we have a way to get the current WakeState not to release it by chance if any other app is relying on it ?
    Many thanks for that
     
  2. udg

    udg Expert Licensed User

    Never used wake locks before, but maybe you could set an intent in your Manifest so to have a service in your app called when a wake lock is set by some other app.
    I didn't see any "check wake state" functions in Android PowerManager.

    udg
     
    lemonisdead likes this.
  3. lemonisdead

    lemonisdead Well-Known Member Licensed User

    Thanks udg. But as the Phone library is able to return if the changed state was already held or not, I guess we should be able to read the current state. BTW thanks for having pointed me to the PowerManager. I'll do some more searches.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    I don't see any API that allows you to check whether another app has acquired a wake lock.
     
    lemonisdead likes this.
  5. lemonisdead

    lemonisdead Well-Known Member Licensed User

    Excuse, I don't get it : if the Phone library is able to tell us that the wanted state was already acquired can't we get the value before to modify it ?
    Sorry for the newbie question because I don't have a "understanding" of the question.
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    The phone library only knows whether your app has already acquired a lock.
     
    lemonisdead likes this.
  7. lemonisdead

    lemonisdead Well-Known Member Licensed User

    OK. Thank you very much. I now understand :)
     
  8. inakigarm

    inakigarm Well-Known Member Licensed User

    lemonisdead likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice