How to debug a Delphi application for Android when a user closes an application

I am using Delphi binding to connect an Android FMX application to a VCL desktop application.

When a user closes the Android application on his phone, I would like it to be shown on the desktop that he is no longer tied.

I am using the following:

procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
var
  I: Integer;
begin
  for I := TetheringManager1.PairedManagers.Count - 1 downto 0 do
    TetheringManager1.UnPairManager(TetheringManager1.PairedManagers[I]);
end;

procedure TMainForm.FormDestroy(Sender: TObject);
begin
  TetheringAppProfile1.Enabled:=False;
  TetheringManager1.Enabled:=False;
end;

This works fine if the user closes the Android application using the back button. If you go to the list of open applications and close the application, then nothing works at all.

Tried FormClose, FormDestroy, FormDeactivate. None of the events are triggered.

Delphi 10 Berlin Android 6.0.1

+4

Source: https://habr.com/ru/post/1654770/