I am currently developing a mobile application and my current target platform is Android (since that is the current device I have). However, I want to try and make it compatible with IOS and Windows (testing) as well
My current code for exiting my application uses:
uses FMX.Platform.Android
procedure TfrmMain.btnExitClick(Sender: TObject);
begin
MainActivity.finish;
end;
How do i make this compatible with IOS or Windows (when testing)? Simply using Close does not work in Android.
You can use conditional compilation to write multi-platform code:
{$IFDEF MSWINDOWS}
// Do something...
{$ENDIF}
{$IFDEF MACOS}
// Do something...
{$ENDIF}
{$IFDEF Android}
// Do something...
{$ENDIF}
{$IFDEF iOS}
// Don't do anything
{$ENDIF}
Also, take a look at this previous question for more details, especially for closing an application on Android: How to close android app in Delphi-XE5 Firemonkey application?