TencentImSDKPlugin.v2TIMManager.getGroupManager()
core class.removeGroupListener
(Details) to remove the group event listener.TencentImSDKPlugin.v2TIMManager.setGroupListener(listener: V2TimGroupListener());
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 a groupTencentImSDKPlugin.v2TIMManager.joinGroup(groupID: "groupID",message: "hello",groupType: "Public");// Listen for the group join eventTencentImSDKPlugin.v2TIMManager.addGroupListener(listener: V2TimGroupListener(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: "groupID",userList:[]);// Listen for the group invitation eventTencentImSDKPlugin.v2TIMManager.addGroupListener(listener: V2TimGroupListener(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(info: V2TimGroupInfo.fromJson({"groupAddOpt":GroupAddOptTypeEnum.V2TIM_GROUP_ADD_AUTH}));// 2. The group owner listens for and processes requests to join the group.TencentImSDKPlugin.v2TIMManager.addGroupListener(listener: V2TimGroupListener(onReceiveJoinApplication: (groupID, member, opReason) async {// Get all the requestsV2TimValueCallback<V2TimGroupApplicationResult> appls = await groupManager.getGroupApplicationList();appls.data.groupApplicationList.forEach((application) {// ApprovegroupManager.acceptGroupApplication(groupID: application.groupID, fromUser: application.fromUser, toUser: application.toUser,type: GroupApplicationTypeEnum.values[application.type]);// RejectgroupManager.refuseGroupApplication(groupID: application.groupID, fromUser: application.fromUser, toUser: application.toUser, addTime: application.addTime, type: GroupApplicationTypeEnum.values[application.type]);});},));// ******User******//// 1. The user requests to join the group.TencentImSDKPlugin.v2TIMManager.joinGroup(groupID: "groupID",message: "hello",groupType: "Public");// 2. The user listens for the request review result.TencentImSDKPlugin.v2TIMManager.addGroupListener(listener: V2TimGroupListener(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 groupsV2TimValueCallback<List<V2TimGroupInfo>> groupRes =await groupManager.getJoinedGroupList();
// Leave a groupTencentImSDKPlugin.v2TIMManager.quitGroup(groupID: "groupID");TencentImSDKPlugin.v2TIMManager.addGroupListener(listener: V2TimGroupListener(onMemberLeave: (groupID, member) {// Information of the member who left the group},));
onGroupRecycled
callback (Details).// Disband a groupTencentImSDKPlugin.v2TIMManager.dismissGroup(groupID: "groupID");// Listen for the eventTencentImSDKPlugin.v2TIMManager.addGroupListener(listener: V2TimGroupListener(onGroupDismissed: (groupID, opUser) {// The group is disbanded.},onGroupRecycled: (groupID, opUser){// The group is reclaimed.}));
onReceiveRESTCustomData
.
Was this page helpful?