How to Get TTetheringProfileInfo from ARemoteResource in ProfileResourceReceived Event?


I have been googling all day and keep seeing the same 10 examples for FireMonkey, apptethering and Delphi XE6. I am new to XE6 and app tethering. I thank you for any help I can get.

I have Delphi XE6. I am trying to create a tethered FireMonkey application for the android platform. I have a VCL application that will run on a server. There will be many android tablets connecting to the server application at the same time.

The user pushes a button on a tablet which will cause a unique id to be sent to the server using the SendString method of the TTetheringAppProfile. The server has a TetherProfileResourceReceived event and gets the unique id from the AResource.Value. The server queries a database and gets a record. This is all good.

Now I need to send the record back to the SAME profile that sent the request. Every example I have seen uses the item index to get the TTetheringProfileInfo for send string (TetherProfile.Resources.Items[0].Value). I think I can’t rely on the index because I will have multiple connections. I want to send the response string right back to the requesting profile.


procedure TfrmTabletServer.POSTetherProfileResourceReceived(
const Sender: TObject; const AResource: TRemoteResource);
RequestID : Integer;
SendRec := String;
Requester : String;

Requester := AResource.Name;
if AResource.ResType = TRemoteResourceType.Data then begin
RequestID := AResource.Value.AsInteger;
SendRec := GetRecord(RequestID);
//this works but I cant rely on index name due to multiple connections
//POSTetherProfile.Resources.Items[0].Value = SendRec;

//I would prefer to use SendString to keep the requests temporary
//I can’t figure out how to get the TTetheringProfileInfo from the AResource
POSTetherProfile.SendString(‘TTetheringProfileInfo from AResource?’,’Response ‘ + ID.AsString, SendRec);


Comments are closed.