4

I am using Delphi's tethering to connect a FMX Android app to a VCL desktop app.

When the user closes the Android app on their phone, I would like the desktop to show that it is no longer tethered.

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 perfectly, as long as the user closes the Android app using the back button. If you go to the open app list and close the app from there, then nothing fires off at all.

Have tried FormClose, FormDestroy, FormDeactivate none of the events seem to fire.

Delphi 10 Berlin Android 6.0.1

Maya
  • 421
  • 6
  • 12

0 Answers0