Invalid SCREEN_BRIGHTNESS range


Status
Not open for further replies.

Toni Corcanoe

Members
Nov 3, 2019
3
5
I am a developer and I am trying to set the screen brightness of the device using this code:

android.provider.Settings.System.putInt(MyContext.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
android.provider.Settings.System.putInt(MyContext.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS, MyValue);

It works great in other devices, but it seems like it doesn't work for Xiaomi devices.
According to Android instructions, value must be from 0 to 255.

But I have read here that depending on the Xiaomi device, the range can be from 0 to 4000. As there is no way to get the maximum value for this range, how are we able to solve this issue?
What I need is:
-Either have Xiaomi devices work as the rest of manufacturers (according to Android standards) and have the range from 0 to 255
-Or have Xiaomi devices to allow developers know what is the maximum value for the range.
 
Thanks for answering.

I don't have a xiaomi device with me. That problem is reported to me by Xiaomi users, using my app, so I am afraid it is not easy for me to investigate deeper.
I am also new to this site so I don't know exactly where to go. Could you tell me the exact forum please?
 
Oh ok, I thought this was a bug report for Xiaomi like other companies have. So, if anyone could tell me where to post a bug please let me know.
Thank you all.
 
  • Like
Reactions: polonyk
Status
Not open for further replies.