Question about room properties

0 votes
So I want to make an user to join his friend. I make the user write the friend's name and check if he is connected. Then, if he is connected, I want to make the user join the room created by his friend. How do I check the rooms owners (I've never used Hashmaps and so and I dont know how to use them and what they do)?

Also, is it possible to have different users with the same name? And if not, how do I check if a name is used by another user?

Sorry for my bad english and sorry for my noobies questions. Thanks in advance
asked Jul 3, 2016 in Android by Raul Mateo (15 points)

1 Answer

0 votes

Hi Raul,

Greetings!!!!

Here are the steps that you need to follow to join the room created by your friend.

1. Call getOnlineUsers() API, you will be getting a callback in onGetOnlineUsersDone fucntion of ZoneRequestListener. You can fetch all the coonected users here like.

 @Override
    public void onGetOnlineUsersDone(AllUsersEvent event) {
        for(int i=0; i<event.getUserNames().length; i++){
            System.out.println("userName is -"+event.getUserNames()[i]);
        }
    }

2.  As you konw your friend name, you need to validate here if friend is connected then move to next step.

3. Call getAllRooms() API, you will be getting a callback in onGetAllRoomsDone of ZoneRequestListener. here you can fetch all the rooms.

 @Override
    public void onGetAllRoomsDone(AllRoomsEvent event) {
        for(int i=0; i<event.getRoomIds().length; i++){
           System.out.println("RoomId "+event.getRoomIds()[i]);
        }        
    }

4.  Call getLiveRoomInfo(String roomid) API , You will gets the detail of room in onGetLiveRoomInfoDone like owner Name, If owner is your friend you can join this room.

You can not connect with AppWarp with the same userName, if you want to do so you will be getting Auth Error in response result code.

Let me know if you have more queries.

Thanks

Vishnu Garg

answered Jul 4, 2016 by Vishnu Garg (674 points)
Thank you sir! The best answer I could get, seriously, thank you for taking the time to answer me!
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...