Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Keeping track of connected devices: App tethering



Permlink Replies: 4 - Last Post: Jan 3, 2017 6:48 AM Last Post By: Maxime Bonin
Maxime Bonin

Posts: 61
Registered: 1/23/17
Keeping track of connected devices: App tethering
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 28, 2016 3:15 PM
I tether my Android app to a server app that runs as a Windows service. Since I may have several mobile devices tethered to the server at the same time, I want the server to keep track of all devices at all time.

I've noticed that when on we quit the app on the Android mobile device (by swiping the app off), there's no 'On Close' event triggered. Thus, the server doesn't get notified that the device has become unavailable by an event like 'onRemoteManagerShutdown' or 'onUnPair'.

How can I manage to inform the server to delete the device that quitted the app from its connected device list ?
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Keeping track of connected devices: App tethering
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 29, 2016 7:51 AM   in response to: Maxime Bonin in response to: Maxime Bonin
Do these help?

TTetheringManager.OnRemoteManagerShutdown – triggered when a paired Remote Manager disconnects.

TTetheringManager.OnUnPairManager – triggered when a Remote Manager unpairs from your Local Manager. The parameter AManagerInfo contains information about the Remote Manager in question.

http://docwiki.embarcadero.com/Libraries/Seattle/en/System.Tether.Manager.TTetheringProfile.OnDisconnect
Maxime Bonin

Posts: 61
Registered: 1/23/17
Re: Keeping track of connected devices: App tethering
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 30, 2016 6:00 PM   in response to: Eli M in response to: Eli M
They work with a Windows application. But when you quit a mobile app (Android) the other tethered device doesn't you are gone ...

Eli M wrote:
Do these help?

TTetheringManager.OnRemoteManagerShutdown – triggered when a paired Remote Manager disconnects.

TTetheringManager.OnUnPairManager – triggered when a Remote Manager unpairs from your Local Manager. The parameter AManagerInfo contains information about the Remote Manager in question.

http://docwiki.embarcadero.com/Libraries/Seattle/en/System.Tether.Manager.TTetheringProfile.OnDisconnect
steven chesser

Posts: 401
Registered: 4/13/09
Re: Keeping track of connected devices: App tethering
Click to report abuse...   Click to reply to this thread Reply
  Posted: Dec 30, 2016 8:20 PM   in response to: Maxime Bonin in response to: Maxime Bonin
I was playing with the photowall demo source

Could something like this work? When the WillTerminate is triggered, to call code to unpair?

function TForm49.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean;
var
  I: Integer;
begin
  case AAppEvent of
    TApplicationEvent.WillTerminate:
      begin
        for I := TakePhotoManager.PairedManagers.Count - 1 downto 0 do
          TakePhotoManager.UnPairManager(TakePhotoManager.PairedManagers[I]);
      end;
  end;
end;


I tried this with the Server side showing connect/disconnects and the above code would trigger the unpair on closing the app.
Maxime Bonin

Posts: 61
Registered: 1/23/17
Re: Keeping track of connected devices: App tethering
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 3, 2017 6:28 AM   in response to: steven chesser in response to: steven chesser
My Android mobile app won't trigger the 'WillTerminate' event when the user swipe the app off to close it.

Sounds like I'll have the server scan its connected devices in order to keep my 'connected devices list' updated ...

http://stackoverflow.com/questions/30084857/tapplicationevent-willterminate-not-triggered-on-ios-and-android


steven chesser wrote:
I was playing with the photowall demo source

Could something like this work? When the WillTerminate is triggered, to call code to unpair?

function TForm49.HandleAppEvent(AAppEvent: TApplicationEvent; AContext: TObject): Boolean;
var
  I: Integer;
begin
  case AAppEvent of
    TApplicationEvent.WillTerminate:
      begin
        for I := TakePhotoManager.PairedManagers.Count - 1 downto 0 do
          TakePhotoManager.UnPairManager(TakePhotoManager.PairedManagers[I]);
      end;
  end;
end;


I tried this with the Server side showing connect/disconnects and the above code would trigger the unpair on closing the app.

Edited by: Maxime Bonin on Jan 3, 2017 6:47 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02