How to check an user join Zone?

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

Moderators: Lapo, Bax

hoanghuybao
Posts: 35
Joined: 22 Aug 2015, 16:20

How to check an user join Zone?

Postby hoanghuybao » 06 Jan 2016, 16:20

Hi admin,
I have some small queries:
How an user client can be notified if the other user join Zone? Or How to check a user is online? Which the API of smartFox support this?
Please help give your comment. :D

Cheer,
User avatar
Lapo
Site Admin
Posts: 20217
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How to check an user join Zone?

Postby Lapo » 07 Jan 2016, 09:23

Hello,
hoanghuybao wrote:How an user client can be notified if the other user join Zone?

Using the Buddy List API:
http://docs2x.smartfoxserver.com/Advanc ... y-list-api

Or How to check a user is online?

Again, using the buddy list each User can know the online status of all the people in his buddy list.

If you want to check for a specific User from the server side, you can use this code:
boolean isUserOnline = getParentZone().getUserManager().containsName("SomeUserName");


This will return true if the user with that name is logged in the server.

Which the API of smartFox support this?

You mean client API?
On the client side a User is only aware of the other Users in the Room(s) that he has joined. Also he can be aware of the status of the Users in the Buddy List.
If you want to check other Users that are outside this scope (joined Rooms + buddy list) you will need to ask the server via an Extension call.

The server will then check via the example I posted and send a reply to the client, if this is what you're looking for.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
hoanghuybao
Posts: 35
Joined: 22 Aug 2015, 16:20

Re: How to check an user join Zone?

Postby hoanghuybao » 11 Jan 2016, 16:07

Hi Lapo,

I appreciate your answer. It is very full :D. Thank you very much.

Cheer,

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 1 guest