Hi there! Today I am going to publish my third extension - BrightnessTools
A simple extension to set your brightness!
Documentation
Blocks
Description
Raises when error occurred
Params
Type
Description
error
String
Return a description of error
Triggered when detected any brightness or adaptive change. The param "changed" indicate what has change.
Params
Type
Description
changed
Number (int)
Return what has been changed. 0 = Brightness Change, 1 = Adaptive Change
brightness
Number (int)
Return current brightness
adaptive
boolean
Return current adaptive state
Returns: Boolean
Check if modify system setting permission is granted.
Returns: Number (int)
Get Max brightness of user's phone. If max brightness not found, return 255.
Note: Android states that the maximum value should be 255.
However, different brands of phones have different settings, like some Xiaomi phones have a maximum of 4000.
Register the listener for Changed
Show screen for controlling which apps are allowed to write/modify system settings.
Set the brightness of user's phone. Minimum value is 0.
Params
Type
Description
Brightness
Number (int)
Set/Return the brightness depends on the given integer
Set brightness to adaptive or non-adaptive. Adaptive if true, otherwise non-adaptive.
As the modify settings permission might be greyed out sometimes, now it would enable that back.
You don't need ActivityStarter to grant the permission anymore. Instead, you can use the OpenWriteSettingsScreen method.
v1.1
Big update! Added Listener for brightness and adaptive change
Optimized the code
Note
This extension will only be distributed in Kodular and AI2 communities. Reuploading my work is not allowed.
You need to grant WRITE_SETTINGS permission. For more please see this post. You can use either the method from Screen or use the OpenWriteSettingsScreen directly from my extension. Please note that only the Android version starting from 6.0 needs this permission. At the lower versions, it should be granted when the app is installed.
which device and Android version are you using for your tests?
Taifun
PS: the paid version of my settings extension is also able to set the brightness...
Here you will find an exemple with button to Allow Write Settings permisssion.
when this permission is granted you can change brigthness
ther is a button to keep screen on and an other to sleep it according to screen settings.
for this i used some extentions: de.ullisroboterseite.ursai2applauncher.aix (29,4 Ko) to go to permissions setting screen de.UllisRoboterSeite.UrsAI2WakeLock.aix (11,6 Ko) to keep screen on
both from https://ullisroboterseite.de/index.html
his site is full of interresting extentions...you can donate to him...
and i wrote a small extension to add "android.permission.WRITE_SETTINGS" in manifest in order to be able to turn it on.jml.SETTINGSpermission.aix (4,9 Ko)
Thank you for your extension jml.SETTINGSpermission.aix
It works very well in setting the permission.
I combined it with this activity starter code from BeeriaApps to allow user to activate modify write settings slider.
Hello everyone, I read the entire thread and tried all examples with no success. Is there anyone who successfully controlled the brightness of the screen?