Have an amazing solution built in RAD Studio? Let us know. Looking for discounts? Visit our Special Offers page!
C++

Easily Connect Your Local Devices Together With App Tethering

With Delphi and C++Builder it is now easy to use App Tethering if you want to build applications that can communicate with other applications on the same machine or located on remote hosts. It is now simpler to communicate and share information across multiple platforms: mobile or Windows.
For a quick intro, just to keep you interest alive and make you start building your first tethering applications, take a look at the following video as it describes how easy is to build an image sharing application across multiple platforms. For instance, you can take a photo with your mobile phone and share it with your FireMonkey Delphi application on Mac OS X and also with Delphi VCL running on Windows.

 
The App Tethering feature (introduced in Delphi XE6) can be implemented using the App Tethering components which utilize either Bluetooth or IP networking. It is a peer-to-peer connection between two or more applications but can also act like a client/server architecture with which most of you are familiar with.
The RTL provides support for the IP and Bluetooth connections by simply changing a property. Regarding the platforms supported, you will be able to compile on Windows, OS X, iOS and Android. For LAN the tethering, please note that the Indy library is used (most of you familiar with it from earlier Delphi versions).
For a brief introduction, check out the following post titled App Tethering: Overview by Malcolm Groves.
To get started, use an instance of TTetheringManager and TTetheringAppProfile. These components are the core of your application. You can use them on your main form (although we recommend the use of a TDataModule if you would like a cleaner implementation).
App Tethering operates with “Actions” and “Resources”. Actions are methods that can be executed remotely on instances or applications located on remote hosts. These methods are encapsulated in TActions. The TTetheringManager, as the name suggests, manages the connections between the applications. It also handles remote notifications (when messages and resources are available for your application).
For a detailed explanation on how to use these components, please take a look at Malcolm Groves’ post titled App Tethering: Remote Actions.
Resources are pieces of information (files for instance) that can be shared between applications. You can add them using the TetheringAppProfile. Start simple, with images and than pass to more complex data (i.e. query a table from a database and share the dataset)
For more information, please refer to App Tethering: Sharing Persistent Resources Part 1 and Part 2 also by Malcolm Groves.
Nowadays, data security is important and should be a primary concern when you build tethering applications. You can address this issue by using the TTetheringAppProfileBeforeSendData event and encrypt data and TTetheringAppProfileAfterSendData event and decrypt the data. Find out how to do this in the following video.

 
For those who don’t like reading pages of code and instructions there is a small introductory video about App Tethering available as well.

 
The palette of applications you can build is very large: from image transfer for desktop – mobile to more complex applications, for instance a medical heart beat monitor.  For those who are game addicts, a cross platform game can easily be implemented.
As a conclusion, let’s watch the following video demonstrating a heart beat monitor application.

 


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

FMXExpress.com has over 600 articles with all kinds of tips and tricks for Delphi FireMonkey on Android, IOS, OSX, Windows, and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES