Im using Android. I have two Android devices. The first is creating a room. The second tries to
join that room by invoking "joinRoomInRange". But surprise surprise: It doesnt work somehow.
I checked if theres any room available by invoking "getAllRooms". I saw that the count of rooms is zero.
In the function "onJoinRoomDone" the event code will always be 2, so it will always create a new room.
I would really appreciate your help!
Heres some code:
The Client class:
public class Client
{
public static WarpClient myGame;
public static String userID = "0";
public static Runnable runConnection = new Runnable() {
@Override
public void run() {
myGame.connectWithUserName(userID);
}
};
public static void connect()
{
WarpClient.initialize("c5be1255ff52056714e535960879f55f5e90c2950faf1f52b6f15c7a531fb56e","25dc5c77b767efe7ac29ac847824c72d041ed3f1f6c662050210281a3b69de17");
try {
myGame = WarpClient.getInstance();
myGame.addConnectionRequestListener(new MyConnectionListener());
myGame.addChatRequestListener(new MyChatListener());
myGame.addZoneRequestListener(new MyZoneListener());
myGame.addRoomRequestListener(new MyRoomRequestListener());
myGame.addNotificationListener(new MyNotificationListener());
createUserID();
new Thread(runConnection).start();
}
catch(Exception e)
{
e.printStackTrace();
}
}
....
Function of ConnectionRequestListener class that implements ConnectionRequestListener:
@Override
public void onConnectDone(ConnectEvent event) {
if(event.getResult() == WarpResponseResultCode.SUCCESS){
System.out.println("yipee I have connected");
Client.myGame.getAllRooms();
Client.myGame.joinRoomInRange(1,1,false);
//Client.goToRoom();
}
}
....
Function of RoomRequestListener class that implements RoomRequestListener:
@Override
public void onJoinRoomDone(RoomEvent event) {
if (event.getResult() == WarpResponseResultCode.SUCCESS) {
// success case
roomId = event.getData().getId();
Client.myGame.subscribeRoom(roomId);
} else if (event.getResult() == WarpResponseResultCode.RESOURCE_NOT_FOUND) {
// no such room found
//Create new one
HashMap<String, Object> data = new HashMap<String, Object>();
data.put("result", "");
Client.myGame.createRoom("superjumper", "shephertz", 2,data);
} else {
Client.myGame.disconnect();
//handleError();
}
}
...