Jump to content
Sign in to follow this  
Minox

Brightness control with different behavior 32/64 bit

Recommended Posts

Hi all, I have a code to maximize and minimize screen brightness for android app, which works fine in 32bit, but not in 64bit. Here is the code:

 

USES Androidapi.JNI.GraphicsContentViewText, Androidapi.Helpers;


procedure TForm1.Button1Click(Sender: TObject); //min
      VAR appParam : JWindowManager_LayoutParams;
    begin
          appParam := TAndroidHelper.Activity.getWindow.getAttributes;
          appParam.screenBrightness := TJWindowManager_LayoutParams.JavaClass.BRIGHTNESS_OVERRIDE_OFF;
          TAndroidHelper.Activity.getWindow.setAttributes(appParam);
    end;

procedure TForm1.Button2Click(Sender: TObject); //max
      VAR appParam : JWindowManager_LayoutParams;
    begin
          appParam := TAndroidHelper.Activity.getWindow.getAttributes;
          appParam.screenBrightness := TJWindowManager_LayoutParams.JavaClass.BRIGHTNESS_OVERRIDE_FULL;
          TAndroidHelper.Activity.getWindow.setAttributes(appParam);
    end;

procedure TForm1.Button3Click(Sender: TObject); //norm
      VAR appParam : JWindowManager_LayoutParams;
    begin
          appParam := TAndroidHelper.Activity.getWindow.getAttributes;
          appParam.screenBrightness := TJWindowManager_LayoutParams.JavaClass.BRIGHTNESS_OVERRIDE_NONE;
          TAndroidHelper.Activity.getWindow.setAttributes(appParam);
    end;

 

I don't understand why it doesn't work, do I have to ask permission for the 64bit app and manually change the brightness?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×