How to code the android to turn the screen completely off just like you press the power button to lock your screen.
I want the user to press the button on the screen and then screen goes off.
I have tried (with permission):
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "tag");
wl.acquire();
but not working for me, please help! thank you!