How to turn off the screen of an Android phone programmatically? I tried using the following code with no luck
PowerManager mPowerManager = (PowerManager) getSystemService(POWER_SERVICE);
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MYTAG");
mWakeLock.acquire();
source
share