Brightness.getSystemBrightnessAsync() issue with Auto Brightness on Android

When using Auto Brightness on Android the function Brightness.getSystemBrightnessAsync() always returns the value of the brightness slider and not the value of the Auto Brightness. With Auto Brightness on the slider value has no usage as the system is controlling the brightness. Therefore it would be great if Brightness.getSystemBrightnessAsync() would return the real value.

Hey @0llum,

As mentioned in the docs, the getSystemBrightnessAsync() method is experimental: https://docs.expo.io/versions/v28.0.0/sdk/brightness#expobrightnessgetsystembrightnessasync

Would you be able to create a feature request on our Canny: Feature Requests | Expo detailing exactly what you want to be able to get from the Brightness API?

Cheers,

Adam

Hey @0llum! thanks for writing in. fwiw, the implementation of Brightness.getSystemBrightnessAsync() is here: https://github.com/expo/expo/blob/master/android/expoview/src/main/java/versioned/host/exp/exponent/modules/api/BrightnessModule.java#L52

and we get Android’s exposed SCREEN_BRIGHTNESS Settings.System  |  Android Developers

To clarify, you are getting the correct value if the user has screen brightness in manual mode (which is also the value shown on the slider), but not the correct value if the user has screen brightness in automatic mode (which is also not consistent with what is shown on the slider)?

hm… idk if theres a better way to implement what you are asking but it looks like Android has a hidden constant to get/set auto brightness android - Change adaptive brightness level programmatically - Stack Overflow

edit: looks there are 3 brightness types in android - foregrounded screen brightness, manual system brightness (consistent with the slider value) and auto system brightness :confused:

Thanks for the quick response. I created a feature request:

Yes exactly, in manual mode it works just fine. I get the value corresponding to the slider. In automatic mode I also get the value of the slider, but that is not the value of the actual screen brightness.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.