Sharing and Running Actions on Remote Applications Using App Tethering
Go Up to Using App Tethering
The app tethering implementation of the RTL provides support for actions. You can use app tethering to:
- Share local actions that connected applications can run remotely.
- Run remote actions that connected applications published.
Before you can share actions using app tethering, add app tethering to your application and prepare your application for discovering, pairing, and connecting to other applications.
Contents
Creating Actions
Before you can share actions using app tethering or run remote actions using local actions, you must understand what actions are these and how to define them:
- If you are using FireMonkey, see FireMonkey Actions.
- If you are using the VCL, see VCL Actions.
- Otherwise, see RTL Actions.
Sharing Actions
To share an existing action:
- Select your TTetheringAppProfile component on the Form Designer and double-click its Actions property on the Object Inspector.
- On the action list editor that opens, click to add a new TLocalAction to the list. A TLocalAction provides sharing information about an actual action.
- With your new TLocalAction selected on the action list editor, open the combo box of the Action property on the Object Inspector and select the existing action that you want to associate with this instance of TLocalAction.
Your action is now shared using app tethering. Connected applications may run this action remotely on your application.
Running Remote Actions
When your application is connected to an application that is sharing actions, you can run those shared actions remotely on the target application.
If you are using groups to connect to other applications, you can associate the remote actions with local actions at design time. Running these local actions triggers the execution of the associated remote actions.
Alternatively, regardless of whether or not you use groups to connect to other applications, you can run synchronous or asynchronous remote actions at run time using their action name.
Running Remote Actions Using Local Actions on Applications Connected Using Groups
To associate a local action with a remote action at design time:
- Create an action with the same Name as the remote action that you want to trigger. See Creating Actions.
- Follow the steps above to share this action using app tethering.
- With your new TLocalAction selected on the action list editor, change its Kind property on the Object Inspector to Mirror.
When you change the Kind of your TLocalAction to Mirror, your TLocalAction does not share the action that you defined in its Action property. Instead, every time that you run the associated action in your application, TLocalAction triggers any remote action with the same Name as the name that you specified in your TLocalAction.
Running Remote Actions Using RunRemoteAction
Your TTetheringAppProfile component provides a method, RunRemoteAction, that you can use to run remote actions.
You can specify a remote action to run with either of the following sets of parameters:
- Provide the remote application profile that contains the remote action as an instance of TTetheringProfileInfo and the name of the remote action.
- The RemoteProfiles property of your TTetheringManager component provides a list of remote application profiles that are connected to your profile.
- Provide an instance of TRemoteAction.
- Your TTetheringAppProfile component provides a method, GetRemoteProfileActions, that returns a list of remote actions shared by a given remote application profile specified as an instance of TTetheringProfileInfo.
Running Remote Actions Using RunRemoteActionAsync
Your TTetheringAppProfile component provides a method, RunRemoteActionAsync, that you can use to run asynchronous remote actions. By running asynchronous remote actions, the caller is not blocked until the remote action finishes.
You can specify a remote action to run with either of the following sets of parameters:
- Provide the remote application profile that contains the remote action as an instance of TTetheringProfileInfo and the name of the remote action.
- The RemoteProfiles property of your TTetheringManager component provides a list of remote application profiles that are connected to your profile.
- Provide an instance of TRemoteAction.
- Your TTetheringAppProfile component provides a method, GetRemoteProfileActions, that returns a list of remote actions shared by a given remote application profile specified as an instance of TTetheringProfileInfo.
See Also
- Adding App Tethering to Your Application
- Connecting to Remote Applications Using App Tethering
- Sharing Data with Remote Applications Using App Tethering
- BDShoppingList sample
- DesktopCast sample
- MediaPlayer sample
- PhotoWall sample