cupboy 0 Posted October 1, 2023 (edited) Here is my code: function TfrmMain.SetScreenBrightness(Brightness: Byte):System.string; var iResult : Byte; MobilePermissions1 : TMobilePermissions; begin iResult := 0; {$IFDEF ANDROID} MobilePermissions1 := TMobilePermissions.Create(self); MobilePermissions1.Signature.WriteSettings := True; MobilePermissions1.Apply; if HasPermission('android.permission.WRITE_SETTINGS') then begin TJSettings_System.JavaClass.putInt( TAndroidHelper.Context.getContentResolver, TJSettings_System.JavaClass.SCREEN_BRIGHTNESS, Brightness); iResult := 1; end else ShowMessage('Write Permissions failure!'); {$ENDIF} end; All I get when I run it on the Android 12 phone is the Write Permissions failure message. Any idea about what the cause would be? On the phone I have set Modify system settings to Allowed ... still fails. Well nevermind it is fixed now. Here is the fix: // if HasPermission('android.permission.WRITE_SETTINGS') then if TJSettings_System.JavaClass.canWrite(TAndroidHelper.Context) then GitHub - adrianosantostreina/MobilePermissions: This is a component to turn more easy the request permission in Android 8.x or later. THIS TOPIC CAN BE DELETED (I don't seem to be able to do it myself... thanks) Edited October 1, 2023 by cupboy Share this post Link to post
Patrick PREMARTIN 82 Posted October 1, 2023 Hi Please open a request on the project if it's a bug and of course give the solution if you have it. Share this post Link to post