SoFunction
Updated on 2025-03-01

2 ways to keep the screen on Android light


private PowerManager powerManager = null;
private WakeLock wakeLock = null;
 
powerManager = (PowerManager) (Service.POWER_SERVICE);
wakeLock = (PowerManager.SCREEN_DIM_WAKE_LOCK, "My Lock");
//Does the number of locks need to be calculated?
(false);
 
//Resume()
();
 
//Cancel the screen is always on, onPause()
();