MessageDlg('Please turn on your gps', TMsgDlgType.mtConfirmation,
[
TMsgDlgBtn.mbYes,
TMsgDlgBtn.mbNo,
TMsgDlgBtn.mbClose
], 0,
procedure(const AResult: TModalResult)
begin
case AResult of
mrYES: begin
LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_LOCATION_SOURCE_SETTINGS);
TAndroidHelper.Context.startActivity(LIntent);
end;
mrNo:
Close;
mrClose:
Close;
mrNone:
Close;
end;
end);
Here are some code snippet I have been trying, I don't want to let the user proceed and close the app when the user click return button on the phone.
CodePudding user response:
Thanks for everyone help. if-else case work.
MessageDlg('Please turn on your gps', TMsgDlgType.mtConfirmation,
[
TMsgDlgBtn.mbYes,
TMsgDlgBtn.mbNo
], 0,
procedure(const AResult: TModalResult) begin
if AResult = mrYES then begin
LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_LOCATION_SOURCE_SETTINGS);
TAndroidHelper.Context.startActivity(LIntent);
end
else Close;
end);