Bug with Expo.Brightness.getBrightnessAsync()

#1

This function executes as expected on iOS returning a number between 0 and 1.

However on Android, it returns -1 which is causing issues in my apps.

Has anyone else encountered this?

I’m using Expo SDK 23

#2

hi there!

it looks like the documentation is incorrect here. on android:

A value of less than 0, the default, means to use the preferred screen brightness. 0 to 1 adjusts the brightness from dark to full bright.

so, if you haven’t set the brightness yet it will return -1 which is just whatever the user has set for the system. if you want to get their system brightness (one they control through notification drawer) you can use this: https://docs.expo.io/versions/latest/sdk/brightness.html#expobrightnessgetsystembrightnessasync

#3

Thanks, that works :slight_smile: