Anyone has example of static or global sfsClient.

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

Moderators: Lapo, Bax

Post Reply
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Anyone has example of static or global sfsClient.

Post by mmilen »

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: 311
Joined: 09 Nov 2010, 00:48
Contact:

Post by mmilen »

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

Re:

Post by mihi »

mmilen wrote:Found a solution by wrapping up client in a Android Service.
Can you share you solution?
Thanks.
mmilen
Posts: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: Anyone has example of static or global sfsClient.

Post by mmilen »

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: 311
Joined: 09 Nov 2010, 00:48
Contact:

Re: Anyone has example of static or global sfsClient.

Post by mmilen »

The code I posted from 10 years ago here: https://forums.smartfoxserver.com/viewt ... 22&t=12457 is good to this day. App Bridge Baron is still around.
Post Reply