I have to use the wakelock (yes I shouldn't for the obvious reasons but I'm being paid to do it so I don't have a choice lol)
my question is very simple: when I leave the app onPause or onStop, is the wake lock of the app automatically released ?
I want to avoid the user closing his app and the wake lock is still on for some weird reason.
I'm having an issue with my current system where the app is calling up the release wake lock through a message handler (because its coming from another thread) and this happens "too late" and the app crashes because it does no longer have the reference to the wake lock.
I might not be very clear but the main question here is :
do I have to worry about the wake lock of my app affecting the phone outside the life cycle of the app.
cheers
Jason
my question is very simple: when I leave the app onPause or onStop, is the wake lock of the app automatically released ?
Nope. Which is why you should use android:keepScreenOn
in an activity rather than a WakeLock
.
do I have to worry about the wake lock of my app affecting the phone outside the life cycle of the app.
Absolutely. Until you release that WakeLock
, the phone will not fall asleep.