Delphi/Firemonkey How to call Settings.System.canWrite(context) (Android)


I’m using Delphi 10.3 Community Edition and want to use the WRITE_SETTINGS in my application to set the brightness.
I could get it managed to implement this procedure to call the settings dialog:

procedure RequestWriteSettings;
Intent: JIntent;
Intent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_MANAGE_WRITE_SETTINGS);

I can call this procedure in my application, the dialog appears and I can set the necessary permissions.
But I don’t want to call this procedure permanently, because that’s not user friendly.
I need to check if the WRITE_SETTINGS permission is already set, but I don’t know how to implement this in Delphi/Firemonkey.

What I could find is that one has to call the “Settings.System.canWrite(context)” function, but I only can find samples for java.
Calling these kind of java routines in Delphi isn’t that easy. I’m searching around already for some weeks and tried “things on my own”, but still without success.

Can someone provide the code line how this routine has to be called in Delphi?

Thanks so much in advance!

Comments are closed.