我正在开发一个聊天应用程序,我正在使用asmack库,这个代码用于创建Muc空间。
public void createGroup(String group){
String[] temp=group.split("/");
String groupName=temp[0];
String unique=temp[1];
System.out.println("Group_name!!!"+groupName);
System.out.println("Unique!!!" + unique);
try {
MultiUserChat mMultiUserChat = new MultiUserChat(mXMPPConnection, unique + "@muc.202.65.158.173");
// For Providing Nick Name To Conference.
AndFilter var7 = new AndFilter(new PacketFilter[]{new FromMatchesFilter((unique+"@muc.202.65.158.173").toLowerCase() + "/" + groupName), new PacketTypeFilter(Presence.class)});
PacketCollector var8 = this.mXMPPConnection.createPacketCollector(var7);
Presence var5 = (Presence)var8.nextResult((long)SmackConfiguration.getPacketReplyTimeout());
/* if(var5 == null){
Log.e("NEW EROOR:","Catch the Error");
}else {*/
mMultiUserChat.create(groupName);
//setConfig(mMultiUserChat, groupName);
String userjID = mConfig.userName + "@" + mConfig.server;
for (int i = 0; i < NewGroupWindow.selectedjids.length; i++) {
mMultiUserChat.invite(NewGroupWindow.selectedjids[i], "Please join this room");
}
System.out.println("Room Created!!!");
mMultiUserChat.join(userjID);
mMultiUserChat.changeSubject(groupName);
new GetGroups().execute();
//}
}
catch(XMPPException xe){
}
}
这是用于创建空间并邀请成员加入群组的代码。 上面的代码工作得很好,有时它显示“没有来自服务器的响应”。 请告诉我如何解决这个问题
...谢谢