Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Android setting for Dim screen programmatically

Tags:

android

Ho do I set Android system settings to dim after a set period of time.

android.provider.Settings.System.putInt(getContentResolver(),
            Settings.System.DIM_SCREEN, time);

but Settings.System.DIM_SCREEN is deprecated.I also tried Power Manager PowerManager.SCREEN_DIM_WAKE_LOCK which is also deprecated Any other way around for the same.

like image 294
user3207655 Avatar asked Dec 15 '25 02:12

user3207655


1 Answers

WindowManager.LayoutParams WMLP = getWindow().getAttributes();
WMLP.screenBrightness = 0.15F;
getWindow().setAttributes(WMLP);
like image 171
EminenT Avatar answered Dec 16 '25 19:12

EminenT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!