سؤال

Is there any way we can acquire a Partial wacklock when the device goes into a deep sleep mode without triggering a screen ON?

Acquiring the wakelock seems to work only if the device is awake (screen Off).

I need to keep the screen Off.

Edit: I'm editing my question to share my conclusion, i was looking for a way to wake-up the device from the deep sleep with a partial lock, but i was on the wrong way, my real issue was related to handling the Volume buttons key on deep sleep, it seems impossible since Android does NOT broadcast Volume button events on Deep sleep.

هل كانت مفيدة؟

المحلول

Is there any way we can acquire a Partial wacklock when the device goes into a deep sleep mode without triggering a screen ON?

Sure. A partial WakeLock does not turn on the screen, by definition.

Acquiring the wakelock seems to work only if the device is awake

Sure. Your code will only run when the CPU is executing instructions.

A WakeLock does not wake up the device. A WakeLock keeps the device awake. A partial WakeLock does that while not turning on the screen.

I need to keep the screen Off.

While you can avoid turning on the screen yourself, by using a partial WakeLock, you cannot prevent other apps from turning on the screen, if they feel it is in their users' interests to do so (e.g., incoming phone calls).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top