سؤال

All other wake locks makes sense e.g. developer want screen not to go off while performing something. But in partial wake lock documentation says that :

If you hold a partial wake lock, the CPU will continue to run, regardless of any display timeouts or the state of the screen and even after the user presses the power button. In all other wake locks, the CPU will run, but the user can still put the device to sleep using the power button.

Does that mean while performing some operation CPU can go off? Is it required to acquire wake lock in a service?

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

المحلول

Does that mean while performing some operation CPU can go off? Is it required to acquire wake lock in a service?

Of course (and here - for the power off button) ! Things are even more complicated if you are trying to start your service while the device is asleep. You most probably won't make it. Have a look at Commonsware WakefulIntentService - the notion is that using an alarm manager Receiver (which holds a wake lock) you must afterwards get a (static) wakelock while still in onReceive() to keep awake.

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