Anyone has example of static or global sfsClient.

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Anyone has example of static or global sfsClient.

Postby mmilen » 19 Oct 2011, 21:41

I need a solution, so that a sfsClient can live through interface rotation without disconnecting from server, and be accessible from multiple Activities.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Postby mmilen » 27 Oct 2011, 22:23

Found a solution by wrapping up client in a Android Service.
mihi
Posts: 12
Joined: 03 May 2018, 18:38

Re:

Postby mihi » 18 Aug 2021, 16:30

mmilen wrote:Found a solution by wrapping up client in a Android Service.


Can you share you solution?
Thanks.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: Anyone has example of static or global sfsClient.

Postby mmilen » 23 Sep 2021, 04:10

Hi,

In the app manifest, you need to declare a service. Code its class to handle all SmartFox related operations. Services can be accessed from any app screen, and stay up for as long as the app running to you close it in code. App screen can also subscribe to event listeners so they react to service events. I'm not sure if my terminology is right, this was 10 years ago and I have not done any Android coding since.

Unfortunately, the code I build a while back was proprietary and I don't have access to it anymore.
mmilen
Posts: 298
Joined: 09 Nov 2010, 00:48
Contact:

Re: Anyone has example of static or global sfsClient.

Postby mmilen » 23 Sep 2021, 04:14

The code I posted from 10 years ago here: viewtopic.php?f=22&t=12457 is good to this day. App Bridge Baron is still around.

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 14 guests