-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ERROR] Android: Unable to set system brightness #38
Comments
Have you added the following permission?
You can visit Control Device Brightness from React Native App for a clear idea. |
Adding permission is not enough, you have to ask user to enable this permission fe. using |
I tested PermissionsAndroid on RN 0.61.2 and it doesn't offer access to WRITE_SETTINGS and it'll throw an error instead. Of course it'd be great if some developer with skills would update the library to support Android X access to system level. |
Did you manage to solve this in some way for android ?? |
version react-native: 0.59.10 not working with permission |
Have you solved this problem yet and give me the solution..please! |
It's not working because you don't have the permission to change the setting. The ScreenBrightness module has functions exposed to React Native to ask for those permissions Change your manifest to: And add:
Next before using the setBrightness method in JS add this:
I've updated the documentation as well, somebody should make my changes available soon I guess on the docs. |
When trying to call:
ScreenBrightness.setBrightness(value) .then(() => {}, e => console.log('ERROR: ', e))
I receive this console log:
Happens on Android only. Works fine on iOS
The text was updated successfully, but these errors were encountered: