4

How can I use ACQUIRE_CAUSES_WAKEUP? ACQUIRE_CAUSES_WAKEUP must be used with another wakelock or you risk an error:

 java.lang.IllegalArgumentException: Must specify a valid wake lock level.

However, FULL_WAKE_LOCK, SCREEN_DIM_WAKE_LOCK, and SCREEN_BRIGHT_WAKE_LOCK are all deprecated, and ACQUIRE_CAUSES_WAKEUP doesn't work with PARTIAL_WAKE_LOCK

"Cannot be used with PARTIAL_WAKE_LOCK."

docs

So does that mean that ACQUIRE_CAUSES_WAKEUP is effectively useless?

tir38
  • 9,810
  • 10
  • 64
  • 107
Domen Jakofčič
  • 626
  • 1
  • 8
  • 24

1 Answers1

-4

You can use it like this:

PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock screenWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP,
                TAG);
AlexS
  • 918
  • 1
  • 12
  • 28