TencentImSDKPlugin.v2TIMManager.getGroupManager()
core class.removeGroupListener
(Details) to remove the group event listener.TencentImSDKPlugin.v2TIMManager.addGroupListener();
createGroup
advanced API (Details), and the groupID
will be returned in the callback for successful creation.// Create a public group and specify group attributesgroupManager.createGroup(groupType: "Publich",groupName: "groupName",notification: "",introduction: "",faceUrl: "",isAllMuted: false,isSupportTopic: false,addOpt: GroupAddOptTypeEnum.V2TIM_GROUP_ADD_AUTH,memberList: [],);
Type | Method for Joining a Group |
Work group (Work) | By invitation |
Public group (Public) | On request from the user and on approval from the group owner or admin |
Meeting group (Meeting) | Free to join |
Community (Community) | Free to join |
Audio-video group (AVChatRoom) | Free to join |
addGroupListener
to add a group event listener in advance as instructed in Group Event Listener to receive the following group events.joinGroup
(Details) to join the group.onMemberEnter
callback (Details).// Join the groupTencentImSDKPlugin.v2TIMManager.joinGroup("groupID", "hello");// Listen for the group join eventTencentImSDKPlugin.v2TIMManager.addGroupListener({onMemberEnter: (groupID, memberList) => {// Get the information of the user who joined the group},});
inviteUserToGroup
(Details) to invite a user to the group.onMemberInvited
callback (Details), which can contain some UI tips.// Invite the `userA` user to join the `groupA` groupgroupManager.inviteUserToGroup("groupID", []);// Listen for the group invitation eventTencentImSDKPlugin.v2TIMManager.addGroupListener({onMemberInvited: (groupID, opUser, memberList) => {// Get the information of the inviter and the invitee},});
joinGroup
(Details) to request to join the group.onReceiveJoinApplication
group join request notification (Details) and calls getGroupApplicationList
(Details) to get the group join request list.acceptGroupApplication
(Details) to approve a request or refuseGroupApplication
(Details) to reject it.onApplicationProcessed
callback (Details). Here, if isAgreeJoin
is true
, the request is approved; otherwise, it is rejected.onMemberEnter
callback (Details), notifying the group members that someone joined the group.// ******Group owner******//// 1. The group owner changes the group join option to approval required.groupManager.setGroupInfo({groupAddOpt: GroupAddOptTypeEnum.V2TIM_GROUP_ADD_AUTH,});// 2. The group owner listens for and processes requests to join the group.TencentImSDKPlugin.v2TIMManager.addGroupListener({onReceiveJoinApplication: async (groupID, member, opReason) => {// Get all the requestsconst appls = await groupManager.getGroupApplicationList();appls.data.groupApplicationList.forEach((application) => {// ApprovegroupManager.acceptGroupApplication(application.groupID,application.fromUser,application.toUser,GroupApplicationTypeEnum.values[application.type]);// RejectgroupManager.refuseGroupApplication(application.groupID,application.fromUser,application.toUser,application.addTime,GroupApplicationTypeEnum.values[application.type]);});},});// ******User******//// 1. The user requests to join the group.TencentImSDKPlugin.v2TIMManager.joinGroup("groupID", "hello");// 2. The user listens for the request review result.TencentImSDKPlugin.v2TIMManager.addGroupListener({onApplicationProcessed: (groupID, opUser, isAgreeJoin, opReason) => {// The request to join the group is processed.},onMemberEnter: (groupID, memberlist) => {// The user joins the group.},});
setGroupInfo
API (Details) to change the group join option (V2TIMGroupAddOpt
) to "no group join" or "no approval required".V2TIMGroupAddOpt
has the following options:Group Join Option | Description |
GroupAddOptTypeEnum.V2TIM_GROUP_ADD_FORBID | No users can join the group. |
GroupAddOptTypeEnum.V2TIM_GROUP_ADD_AUTH | Approval from the group owner or admin is required to join the group (default value). |
GroupAddOptTypeEnum.V2TIM_GROUP_ADD_ANY | Any user can join the group without approval. |
getJoinedGroupList
(Details) to get the list of joined work groups (Work), public groups (Public), meeting groups (Meeting), and communities (Community, which don't support the topic feature). Audio-video groups (AVChatRoom) and communities (Community, which support the topic feature) are not included in this list.// Get the joined groupsconst groupRes = await groupManager.getJoinedGroupList();
// Leave the groupTencentImSDKPlugin.v2TIMManager.quitGroup("groupID");TencentImSDKPlugin.v2TIMManager.addGroupListener({onMemberLeave: (groupID, member) => {// Information of the member who left the group},});
onGroupRecycled
callback (Details).// Disband the groupTencentImSDKPlugin.v2TIMManager.dismissGroup("groupID");// Listen for the eventTencentImSDKPlugin.v2TIMManager.addGroupListener({onGroupDismissed: (groupID, opUser) => {// The group is disbanded.},onGroupRecycled: (groupID, opUser) => {// The group is reclaimed.},});
onReceiveRESTCustomData
.
Was this page helpful?