DEVICE Brightness

Hello, I need to control de android (and ios) device brightness to get the most intense white the device can have. How can I control this? Is there any way to do it in Blueprints? If not, is there a way to do it in C++?

Thank you!

You need to do this in Java using JNI calls. Something like this:


 
 WindowManager.LayoutParams params = getWindow().getAttributes(); params.screenBrightness = 255; getWindow().setAttributes(params); getWindow().addFlags(WindowManager.LayoutParams.FLAGS_CHANGED); 

Brightness above can be 0 to 255.

2 Likes

Thank you Chris, I will check how to do the JNI calls for Java, and test it…

Hi Chris, I looked for ways to make a JNI Call, but I only found some posts with problems, and couldn´t find a clear way to do it. I am working with blueprints, but I supposed that I have to make a C++ function, so I can call it from my Blueprint. My problem is how to make that C++ function for making the JNI call you told me.

Thank you very much.

You need to have the Java code inserted into GameActivity.java by UPL then have C++ code call your Java code with JNI. If you want to call it from Blueprint you also need to register a UFUNCTION to call your JNI call.

1 Like

Thank you… I will try it…