Hide screenshot for App Switcher in FMX iOS App


In a mobile iOS system, when double-pressing on the home button, the user will enter an App Switcher, a series of App windows will be displayed. If your own App window has sensitive info, it can be leaked at this stage.
I have managed to use FMX.Platform to catch different App events. I was trying to change to another TabItem instead of a sensitive TabItem. My code can compile, but the display on iOS still remains the same. The code looks like this:
procedure TForm1.FormCreate(Sender: TObject);
aFMXApplicationEventService: IFMXApplicationEventService;
if TPlatformServices.Current.SupportsPlatformService(IFMXApplicationEventService, IInterface(aFMXApplicationEventService)) then
ShowMessage(‘Application Event Service is not supported.’);

function TForm1.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean;
if AAppEvent = TApplicationEvent.aeWillBecomeInactive then begin
tempActiveTbaItem := TabControl1.TabIndex;
TabControl1.TabIndex := 4; //4 is a blank tabItem
end else
if AAppEvent = TApplicationEvent.aeEnteredBackground then begin
tempActiveTbaItem := TabControl1.TabIndex;
TabControl1.TabIndex := 4;
end else
if (AAppEvent = TApplicationEvent.aeBecameActive) and (tempActiveTbaItem <> -1) then begin
TabControl1.TabIndex := 0;

Result := True;

I googled the web and found two solutions here:
Making sensitive data disappear in the iOS/iPadOS App Switcher
Hide Sensitive Information in the iOS App Switcher Snapshot Image
But these are for the native Xcode only. Can someone tell me how to do it in Delphi for FMX, please?

Comments are closed.