I need, when the user clicks the "Close" button, to destroy the application. If you specify Action = caFree, the application remains hanging in memory, not destroyed, the Destroy methods in the application and service do not work:
procedure TfmMain.FormClose(Sender: TObject; var Action: TCloseAction); begin DM.LocationSensor.Active := false; Action := TCloseAction.caFree; end; If you destroy the application in the smartphone through the "Latest Applications", then the application is destroyed, the application service restarts, and continues to work - that's what I need.
Help please understand how to properly destroy the application when you close the main form?
Solutions suitable for sending Intent where needed, or calling native Android methods.