[FREE] BrightnessTools - Set brightness of your phone

Introduction

Hi there! Today I am going to publish my third extension - BrightnessTools
A simple extension to set your brightness! :iphone: :bulb:

Documentation



Blocks Description
WhenErrorOccurred
Raises when error occurred

Params Type Description
error String Return a description of error

WhenChanged
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

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.

Params Type Description
Brightness Number (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.

Params Type Description
Adaptive Boolean Set/Return adaptive or non-adaptive

Download

v1.2

com.watermelonice.BrightnessTools.aix (16.3 KB)

v1.1

com.watermelonice.BrightnessTools.aix (14.0 KB)

v1.0

com.watermelonice.BrightnessTools.aix (10.7 KB)

Test AIA

TestBrightnessExt.aia (27.4 KB)

Change Log

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

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 Requesting extension for app brightness without requiring permissions - #9 by Mohamed_Tamer

29 Likes

Congrats @WatermelonIce. :+1:t2:

1 Like

Great extension :partying_face:

1 Like

Thanks guys!

1 Like

I just want to ask a question.Should we ask the permission manually or the extension will ask it automatically?

The extension won’t ask it. I didn’t include it because it might cause this problem

Therefore, use this to check if the permission granted:
image

And use this to open that settings:
image
(for only android 6+)

1 Like

Nice Extension, your extensions are nice :upside_down_face:

1 Like

Very Nice Extension !! Best !! Very Helpful !! :blush:

Great Extension

Nice extension. @WatermelonIce, I am following you works. Those are superb. Keep koding. All the best.

2 Likes

Thanks fot supporting :blush:

Great work as usual.

1 Like

Really? I don’t think I make great extension as usual :sweat_smile:

Anyway thanks :stuck_out_tongue_winking_eye:

Your extensions are useful so that makes them great.

2 Likes

Awesome work congratulations for being an extension developer :heart:

1 Like

Useful extension.
Keep it up.
I am older than these guys.
I don’t know extension development. :sweat_smile:

2 Likes

🙋🙋 Same here :grin:

3 Likes

Thanks guys!

Age doesn’t matter.

3 Likes

New big update! You can now register listener for brightness change!

2 Likes

WatermelonIce, thank you for your nice extension, but i cant grant write permisions, i dont know wy. Please help me. Have you an .AIA example?

Thank you, Jemax

2 Likes