createGroup()
method. This method takes a Group object as a parameter that takes all the information related to the group. So, in order to create a group, you will have to create an object of the group and assign all the values to the group.
To create a group, you can use either of the below two initializers:
new Group(String GUID, String name, String groupType, String password)
new Group(String GUID, String name, String groupType, String password, String icon, String description)
groupType
needs to be either of the below 3 values:
1.CometChatConstants.GROUP_TYPE_PUBLIC
(public) 2.CometChatConstants.GROUP_TYPE_PASSWORD
(password) 3.CometChatConstants.GROUP_TYPE_PRIVATE
(private)
createGroup()
method takes the following parameters:
Parameter | Description |
---|---|
group | An instance of Group class |
createGroupWithMembers()
method. This method takes the Group
Object, Array of Group Member
Object to be added & Array of UIDs
to be banned.
To create an object of Group
class, you can use either of the below two constructors:
new Group(String GUID, String name, String groupType, String password)
new Group(String GUID, String name, String groupType, String password, String icon, String description)
groupType
needs to be either of the below 3 values:
CometChat.GROUP_TYPE.PUBLIC
CometChat.GROUP_TYPE.PASSWORD
CometChat.GROUP_TYPE.PRIVATE
Group Member
class, you can use the below constructor:
Field | Editable | Information |
---|---|---|
guid | Needs to be specified at group creation. Cannot be edited later | A unique identifier for a group |
name | Yes | Name of the group |
type | No | Type of the group: Can be 1. Public 2. Password 3. Private |
password | No | Password for the group in case the group is of type password. |
icon | Yes | An URL to group icon |
description | Yes | Description about the group |
owner | Yes | UID of the owner of the group. |
metadata | Yes | Additional data for the group as Dictionary |
createdAt | No | The Unix timestamp of the time the group was created |
updatedAt | No | The Unix timestamp of the time the group was last updated |
hasJoined | No | A boolean to determine if the logged-in user is a member of the group. |
joinedAt | No | The Unix timestamp of the time the logged-in user joined the group. |
scope | Yes | Scope of the logged in user. Can be: 1. Admin 2. Moderator 3. Participant |
membersCount | No | The number of members in the groups |
tags | Yes | A list of tags to identify specific groups. |