Skip to content Skip to sidebar Skip to footer

Android Going To Sleep (standby)

I want my android device to go to sleep (screen off), has someone an idea how to do it? In the past I was using the PowerManager function goToSleep(time), but apparently this func

Solution 1:

private PowerManager mPowerManager;
private PowerManager.WakeLock mWakeLock;

public void sleep(){
      mWakeLock = mPowerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, "tag");
      mWakeLock.acquire();
}

Try this


Post a Comment for "Android Going To Sleep (standby)"