powered by Jive Software

How to send the message to Group using smack library

Hi, I want to send the message to group not individually. I means when i send the message to group then its appear inside the group window only.

XMPPConn.getRoster().createGroup(bulletinTopicText);

String group[] = { bulletinTopicText };

                XMPPConn.getRoster().createEntry("501@vpn.entquest.com", "Chetan", group);

                XMPPConn.getRoster().createEntry("503@vpn.entquest.com", "Maneesh", group);

Toast.makeText(context, getString(R.string.topic_created), Toast.LENGTH_LONG).show();

//Sending Message to Group

Roster roster = XMPPConn.getRoster();

RosterGroup rosterGroup = roster.getGroup(bulletinTopicText);

Collection entries = rosterGroup.getEntries();

for (RosterEntry entry : entries) {

Presence presence = roster.getPresence(entry.getUser());

Presence.Type userType = presence.getType();

Presence.Mode mode = presence.getMode();

String status = presence.getStatus();

Message msg = new Message(entry.getUser(), Message.Type.chat);

msg.setBody(“Hi Testing…Group chat…”);

XMPPConn.sendPacket(msg);

Log.v(“Home Bulletin”, userType + “:” + mode + “:” + status);

}

I am doing like this way but its sending message to member individual not in group. Please help me to send the message to group… and last give hint between group and room chat.

Thanks