1

This works for my purpose to wake up a locked, sleeping, screen off device:

        PowerManager.WakeLock screenOn = ((PowerManager)context
                .getSystemService(context.POWER_SERVICE))
                .newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK |
                        PowerManager.ON_AFTER_RELEASE |
                        PowerManager.ACQUIRE_CAUSES_WAKEUP, "example");
        screenOn.acquire();

        ...

        screenOn.release();

But SCREEN_BRIGHT_WAKE_LOCK is deprecated. What is the replacement to wake up a sleeping phone with the screen off without resorting to using Administrator level permissions?

Also, the screen wakes up of course to full brightness. I just want the screen to wake up to whatever the brightness level was before.

NOTE: This isn't a duplicate as everywhere else is only referring to DIM screen not OFF, LOCK, SLEEPING.

John Smith
  • 3,493
  • 3
  • 25
  • 52
  • THis is one of those "it works, use it" cases. Deprecated doesn't mean they're taking it away, deprecated means they're trying to discourage use because it was abused (by people taking wakelocks when not needed). They haven't fully replaced that functionality in other ways, and are unlikely to. – Gabe Sechan Mar 20 '15 at 00:32
  • Thanks! I'll go with that ;) Any ideas on which deprecated will just wake the screen and not do full brightness? – John Smith Mar 20 '15 at 05:29
  • I would suspect full, as it doesn't mention brightness. Haven't tested though – Gabe Sechan Mar 20 '15 at 05:30

0 Answers0