Android Development: Changing Screen Brightness in Service -


now try again.

i want change screen brightness.

i've tried:

windowmanager.layoutparams layoutparams = getwindow().getattributes(); layoutparams.screenbrightness = 0.5f; // set 50% brightness getwindow().setattributes(layoutparams); 

and seems work in activity when in service getwindow() compile error.

a service cannot change screen brightness way. service not have user interface, not have window.

you can try change brightness system-wide via screen_brightness system setting. have no idea if works, have not tried it.

otherwise, modify activities change brightness.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -