Android Development: Changing Screen Brightness in Service

后端 未结 2 593

Now i do try again.

I want to change the screen brightness.

I\'ve Tried:

WindowManager.LayoutParams layoutParams = getWindow().getAttributes(         


        
2条回答
  •  再見小時候
    2021-01-14 03:07

    A service cannot change the screen brightness that way. A service does not have a user interface, so it does not have Window.

    You can try to change the brightness system-wide via the SCREEN_BRIGHTNESS system setting. I have no idea if this works, as I have not tried it.

    Otherwise, modify your activities to change their brightness.

提交回复
热议问题