Android Question No wakelock


Well-Known Member
Licensed User
Longtime User
i'm starting to looking into phonewakestate as a way to keep the screen from turning off while the gps is tracking me in my little map app. the functions and properties available with this object are few.

as a test, i dim pws as PhoneWakeState object and immediately call pws.ReleaseKeepAlive (without having previously called pws.KeepAlive) to see if something would throw an error. i see "No wakelock." in the log. but no error. maybe it's harmless, but i'm not comfortable with it. since the os can do want it needs to do when it needs to do it, i like to tidy things up if given the chance. ReleaseKeepAlive is one such type of cleanup, but i'd like to know if there was a corresponding KeepAlive before blindly calling ReleaseKeepAlive. is there a way to test the "wake state" without resorting to yet another global flag?