Я создаю приложение чата с использованием xmpp / openfire и хочу создавать группы на сервере, к которым любой на сервере может присоединиться.
Кто-нибудь, пожалуйста, помогите мне в том же.
Я создаю приложение чата с использованием xmpp / openfire и хочу создавать группы на сервере, к которым любой на сервере может присоединиться.
Кто-нибудь, пожалуйста, помогите мне в том же.
Таким образом вы можете создать группу на сервере Xmpp
SmackAndroid.init(SelectMembers.this);
MultiUserChat muc = new MultiUserChat(xconnection, GroupName
+ "@conference.fonechat.in");
muc.create(my_number);
setConfig(muc);
muc = new MultiUserChat(xconnection, GroupName + "@conference.serverid");
muc.join(my_number);
for (int i = 0; i < name.size(); i++) {
muc.invite(phone.get(i).toString() + "@fonechat.in",
"Meet me in this excellent room");
// Функция SetConfig
private void setConfig(MultiUserChat multiUserChat) {
try {
Form form = multiUserChat.getConfigurationForm();
Form submitForm = form.createAnswerForm();
for (Iterator<FormField> fields = submitForm.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);
submitForm.setAnswer("muc#roomconfig_persistentroom", true);
multiUserChat.sendConfigurationForm(submitForm);
} catch (Exception e) {
e.printStackTrace();
}
}
Попробуйте создать постоянный многопользовательский чат (MUC: http://xmpp.org/extensions/xep-0045.html) для каждой группы. Вы сможете отправить сообщение всем в группе, что очень полезно.
Попробуйте QuickBlox.com, у них тоже есть образец программы ..