0
WakeLock wl_cpu = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyCpuLock");
wl_cpu.acquire(8000);
wl_cpu.release();

Good day everyone! I have simple question here. I am using the above code as my wake lock in case user receive notification, and the question is am I releasing the wakelock properly? I just release the wake lock right after calling wl_cpu.acquire()?

In case there is a better place where to call wl_cpu.release(), please let me know. Thanks in advance.

JayR
  • 441
  • 1
  • 4
  • 16
  • Why are you acquiring the wake lock? Are you doing anything at that point? If so, then you need to release it _after_ your work is completed. – corsair992 Jan 26 '15 at 12:06
  • @corsair992, yes I'm doing a wakelock so that the device's home screen will open in case the device is locked off in home screen. Anyway, thanks for your response. – JayR Jan 27 '15 at 02:23

0 Answers0