- 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.
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.