Create Group

Create Group#


To create a group with image url to be uploaded as group profile image call the below method.

GroupManager.createGroup(GROUP_NAME, MEMBERS_JID_LIST, GROUP_IMAGE_ID, (isSuccess, throwable, data) -> {
if(isSuccess){
//Update the UI
}else{
// Group creation failed print throwable to find the exception details.
}
}, "");
ArgumentTypeDescription
GROUP_NAMEStringName of the group(cannot be null or empty)
MEMBERS_JID_LISTList<String>List of jids of the member (size cannot be less than 2
excluding group creator)
GROUP_IMAGE_IDStringurl id of the uploaded image (can be empty)
CALLBACKFlyCallbackFlyCallback implemented as lambda expression
info

There is an overloading method available for createGroup which accepts image as a File instead of url id.


To create a group with image file to be uploaded as group profile image call the below method.

GroupManager.createGroup(GROUP_NAME, MEMBERS_JID_LIST, GROUP_IMAGE_FILE , (isSuccess, throwable, data) -> {
if(isSuccess){
//Update the UI
}else{
// Group creation failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
GROUP_NAMEStringName of the group(cannot be null or empty)
MEMBERS_JID_LISTList<String>List of jids of the member (size cannot be less than 2
excluding group creator)
GROUP_IMAGE_FILEFileimage file to be uploaded as group profile image(can be empty)
CALLBACKFlyCallbackFlyCallback implemented as lambda expression
caution

If there is no internet or the connection between chat server and the app isn't made create group functionality will be executed and group will be created locally. Until the group is available in server messaging/profile update should be restricted in app side by checking the isGroupInOfflineMode property of RecentChat or ProfileDetails class else an exception will be thrown.

Get user list to add to a group#

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

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

above method is available only if contact sync is enabled.

Move offline group to online#

To move the group which is created locally to online(create in server) call the below method.

GroupManager.createOfflineGroupInOnline(GROUP_JID, (isSuccess, throwable, data) -> {
if(isSuccess){
// Group created in server update the UI
}else{
// Group creation failed print throwable to find the exception details.
}
});
ArgumentTypeDescription
GROUP_JIDStringJid of the offline group
CALLBACKFlyCallbackFlyCallback implemented as lambda expression