Shaun Roselt
Shaun Roselt

Reputation: 3242

How to open Android Settings App programmatically with Delphi?

So I want to write a simple Delphi application with a button. When you click on this button then it should open the Settings App on Android. It should not open anything within the settings, but just the Settings app itself.

I want to do this programmatically. What's the code for this? How does one do this in Delphi?

Upvotes: 0

Views: 1415

Answers (2)

Remy Lebeau
Remy Lebeau

Reputation: 595827

Try something like this:

uses
  Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Provider, Androidapi.Helpers;

procedure TForm1.Button1Click(Sender: TObject);
var
  LIntent: JIntent;
begin
  LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_SETTINGS);
  LIntent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); // <-- this might be optional
  TAndroidHelper.Context.startActivity(LIntent);
end;

Upvotes: 2

wBB
wBB

Reputation: 851

I asked something similar ... I did not test for your application, but I believe it works the same way:

How to call the native window of Bluetooth settings on Android in Delphi?

Upvotes: 2

Related Questions