[FREE] BrightnessTools - Set brightness of your phone

Hi there! This is my third extension - BrightnessTools A simple extension to set your brightness!

Documentation



BlocksDescription
WhenErrorOccurred
Raises when error occurred

ParamsTypeDescription
errorStringReturn a description of error

WhenChanged

Triggered when detected any brightness or adaptive change. The param "changed" indicate what has change.

ParamsTypeDescription
changedNumber (int)Return what has been changed.
0 = Brightness Change,
1 = Adaptive Change
brightnessNumber (int)Return current brightness
adaptivebooleanReturn current adaptive state

CanWriteSettings
Returns: Boolean

Check if modify system setting permission is granted.
MaxBrightness
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.
blocks
Register the listener for Changed
OpenWriteSettingsScreen
Show screen for controlling which apps are allowed to write/modify system settings.
GetBrightness
SetBrightness

Set the brightness of user's phone. Minimum value is 0.

ParamsTypeDescription
BrightnessNumber (int)Set/Return the brightness depends on the given integer

GetBrightness
SetBrightness

Set brightness to adaptive or non-adaptive. Adaptive if true, otherwise non-adaptive.

ParamsTypeDescription
AdaptiveBooleanSet/Return adaptive or non-adaptive

Download

https://community.kodular.io/t/free-brightnesstools-set-brightness-of-your-phone/83912

Test AIA

https://community.kodular.io/t/free-brightnesstools-set-brightness-of-your-phone/83912/38?u=watermelonice

Changelog

v1.2
  • 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.

    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 requires this permission. At the lower versions, it should be granted when the app is installed.

    The intention of this extension is to change the brightness of the phone, not just the app. If you want to change the brightness of that app without permission, please refer to https://community.kodular.io/t/requesting-extension-for-app-brightness-without-requiring-permissions/131680/9

    Comments