xmpp - Creating Chat Room In Android Gives Error:"item-not-found(404) -
i developing chat application using asmack. able connect , send messages private chat.however, when trying create chat room error:
item-not-found(404)
this code using:
setconnection(connection); if(connection != null) { try { // smackandroid.init(this); multiuserchat muc=new multiuserchat(connection,"chat1@groupchat.google.com"); muc.create("greatandroid"); log.d("chat room created","successfully created chat room"); form form = muc.getconfigurationform(); form submitform = form.createanswerform(); (iterator fields = form.getfields();fields.hasnext();){ formfield field = (formfield) fields.next(); if(!formfield.type_hidden.equals(field.gettype()) && field.getvariable()!= null){ submitform.setdefaultanswer(field.getvariable()); submitform.setanswer("muc#roomconfig_publicroom", true); muc.sendconfigurationform(submitform); log.d("config form created","successfully configured chat form"); } } } catch(exception ex) {log.d("error creating chat room",ex.getmessage().tostring());}}
how can resolve this?
use code
// the room's configuration form form form = muc.getconfigurationform(); // create new form submit // based on original form form submitform = form.createanswerform(); // add default answers form // submit (iterator fields = form.getfields(); fields.hasnext();) { formfield field = (formfield) fields.next(); if (!formfield.type_hidden.equals(field.gettype()) && field.getvariable() != null) { // sets default value // answer // submitform.setdefaultanswer(field.getvariable()); } } submitform.setanswer("muc#roomconfig_roomdesc", groupname); submitform.setanswer("muc#roomconfig_publicroom", false); // submitform.setanswer("muc#roomconfig_persistentroom", true); // submitform.setanswer("muc#roomconfig_membersonly", false); // submitform.setanswer("muc#roomconfig_allowinvites", true); // jid // submitform.setanswer("muc#roomconfig_whois", "anyone"); // submitform.setanswer("muc#roomconfig_enablelogging", true); // // submitform.setanswer("x-muc#roomconfig_reservednick", true); // // submitform.setanswer("x-muc#roomconfig_canchangenick", // false); // // submitform.setanswer("x-muc#roomconfig_registration", false); // send completed form (with default values) // server configure room muc.sendconfigurationform(submitform);
Comments
Post a Comment