Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodC++BuilderCode SnippetDelphiDemoFiremonkeyIOSOSXWindows

Remotely Control Apps Via App Tethering Or REST In #Delphi XE8 Firemonkey On #Android And #IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE8 Firemonkey Remote Control App Tethering Android IOS | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSIf you are building enterprise applications with Delphi XE8 Firemonkey you may run into the situation where you need to remotely control your app on a user’s device without being in front of the device. Firemonkey makes it easy to remotely control an app on Android, IOS, OSX, and Windows. I have created some sample source code which will take a screenshot of the current application and send it to a second application via the app tethering components. The second application will allow you to click on the screenshot and execute the click on the first application. Basically it works very similarly to how Remote Desktop works in windows. Obviously this is a very rudimentary version as it sends the entire screen each time and is not optimized to only send only the parts of the screen that have changed. You could also deploy this same type of system using the TRESTClient instead of the app tethering components as the idea is the same. Basically you could have a support section in your app where the user would click a Start Remote Session or Sync button. Your app would begin sending screenshots to the remote server via app tethering or REST. Each time the app sends a screenshot it could also listen for a click. Once a click is received it could execute the click in the local app which would complete the remote control loop. This same type of functionality can be used to build a Firemonkey test harness. The magic happens in the custom FindControlAtPoint function which was developed for the TImageCacheLayout component. This same idea and code should also work in Appmethod and maybe C++Builder. Here is a code snippet of that function:
function TForm1.FindControlAtPoint(aParent: TControl; aPos: TPointF): TControl;
var
I: Integer;
Control, ChildControl: TControl;
S: String;
begin
Result := nil;

// Check all the child controls and find the one at the coordinates
for I := aParent.Controls.Count - 1 downto 0 do
begin
Control := aParent.Controls[I];
S := Control.ClassName;
if Control.PointInObject(aPos.X, aPos.Y) then
begin
ChildControl := FindControlAtPoint(Control, aPos);
if Assigned(ChildControl) and ChildControl.HitTest then
Exit(ChildControl)
else
if Control.HitTest then
Exit(Control);
end;
end;
end;

Download the sample source code for remotely controlling an app in Delphi XE8 Firemonkey on Android and IOS.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

Leave a Reply