Android - Turn off display without triggering sleep/lock screen - Turn on with Touchscreen

后端 未结 4 895
小鲜肉
小鲜肉 2020-12-07 14:54

I have been trying to find a way to turn off the display, and wake up from the user touching the touch screen.
The device is in an embedded environment where the device

4条回答
  •  眼角桃花
    2020-12-07 15:11

    You can do one thing that is Acquire Partial Wakelock and turn the Screen Off using :

    PowerManager.WakeLock wl = manager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Your Tag");
    wl.acquire();
    WindowManager.LayoutParams params = getWindow().getAttributes();
    params.screenBrightness = 0;
    getWindow().setAttributes(params);
    

提交回复
热议问题