Manage a Group

Add user to Group#

To add users to a group call the below method.

GroupManager.addUsersToGroup(GROUP_JID,NEW_USERS_JID_LIST, (isSuccess, throwable, data) ->
if(isSuccess){
// Update the UI
}else{
// Adding users to group failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
GROUP_JIDStringJid of the group
NEW_USERS_JID_LISTList<String>Jid list of the new users
CALLBACKFlyCallbackFlyCallback implemented as lambda expression

Get user list to add to a group#

To get the list of users who are eligible to add to a old group call the below method.

List<ProfileDetails> usersList = GroupManager.getUsersListToAddMembersInOldGroup(GROUP_JID);
warning

Those two methods above are available only if contact sync is enabled.

ArgumentTypeDescription
GROUP_JIDStringJid of the group

Remove a group member#


To remove a user from group call the below method.

GroupManager.removeMemberFromGroup(GROUP_JID,REMOVING_MEMBER_JID, (isSuccess, throwable, data) ->
if(isSuccess){
// Update the UI
}else{
// Removing a user from group failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
GROUP_JIDStringJid of the group
REMOVING_MEMBER_JIDStringJid of the user who is going to be removed
CALLBACKFlyCallbackFlyCallback implemented as lambda expression

Make participant as admin#

User can able to make some participant of the group as a admin to the group. The below method can be used to make someone as admin. only admins can perform this action

GroupManager.makeAdmin(GROUP_JID, NEW_ADMIN_JID, LISTENER);
ArgumentTypeDescription
GROUP_JIDStringjid of the group
NEW_ADMIN_JIDStringjid of the group participant
LISTENERChatActionListenercallback to observe the action status

Revoke Admin Access#

Users with admin privileges can revoke a participant's admin access within the group. Only group admins can be perform this action using the below method.

GroupManager.revokeAdmin(GROUP_JID, REVOKE_ADMIN_JID, LISTENER);
ArgumentTypeDescription
GROUP_JIDStringjid of the group
REVOKE_ADMIN_JIDStringjid of the group participant
LISTENERChatActionListenercallback to observe the action status

Leave from a group#


To leave from a group in which you are a member call the below method.

GroupManager.leaveFromGroup(GROUP_JID,USER_JID,(isSuccess, throwable, data) ->
if(isSuccess){
// Update the UI
}else{
// Leaving from group failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
GROUP_JIDStringJid of the group
USER_JIDStringjid of the participant, to exit from the group
CALLBACKFlyCallbackFlyCallback implemented as lambda expression