Get preferred screen brightness in Android

后端 未结 2 518
青春惊慌失措
青春惊慌失措 2020-12-13 07:04

How do you get the preferred screen brightness in Android?

To change the screen brightness I use WindowManager.LayoutParams.screenBrightness. According to the docume

2条回答
  •  悲&欢浪女
    2020-12-13 07:47

    Well to answer the question as asked you can get the prefered brightness from Settings.system.SCREEN_BRIGHTNESS The range looks to be 0-255.

    int UserBrightness = Settings.System.getInt(getContentResolver(), 
                Settings.System.SCREEN_BRIGHTNESS,-1); 
    

    What the curent brightness actualy is at the moment, as set by Automatic mode or an app setting it's own brightness is a different question realy and I would also be interested in the answer.

提交回复
热议问题