IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMGroupManagerabstract

Detailed Description

Advanced group APIs, including APIs for advanced group features such as group member invitation and group joining request

Public Member Functions

abstract void createGroup (V2TIMGroupInfo info, List< V2TIMCreateGroupMemberInfo > memberList, V2TIMValueCallback< String > callback)
 
abstract void getJoinedGroupList (V2TIMValueCallback< List< V2TIMGroupInfo >> callback)
 
abstract void getGroupsInfo (List< String > groupIDList, V2TIMValueCallback< List< V2TIMGroupInfoResult >> callback)
 
abstract void searchGroups (V2TIMGroupSearchParam searchParam, V2TIMValueCallback< List< V2TIMGroupInfo >> callback)
 
abstract void setGroupInfo (V2TIMGroupInfo info, V2TIMCallback callback)
 
abstract void initGroupAttributes (String groupID, HashMap< String, String > attributes, V2TIMCallback callback)
 
abstract void setGroupAttributes (String groupID, HashMap< String, String > attributes, V2TIMCallback callback)
 
abstract void deleteGroupAttributes (String groupID, List< String > keys, V2TIMCallback callback)
 
abstract void getGroupAttributes (String groupID, List< String > keys, V2TIMValueCallback< Map< String, String >> callback)
 
abstract void getGroupOnlineMemberCount (String groupID, V2TIMValueCallback< Integer > callback)
 
abstract void setGroupCounters (String groupID, HashMap< String, Long > counters, V2TIMValueCallback< Map< String, Long >> callback)
 
abstract void getGroupCounters (String groupID, List< String > keys, V2TIMValueCallback< Map< String, Long >> callback)
 
abstract void increaseGroupCounter (String groupID, String key, long value, V2TIMValueCallback< Map< String, Long >> callback)
 
abstract void decreaseGroupCounter (String groupID, String key, long value, V2TIMValueCallback< Map< String, Long >> callback)
 
abstract void getGroupMemberList (String groupID, int filter, long nextSeq, V2TIMValueCallback< V2TIMGroupMemberInfoResult > callback)
 
abstract void getGroupMembersInfo (String groupID, List< String > memberList, V2TIMValueCallback< List< V2TIMGroupMemberFullInfo >> callback)
 
abstract void searchGroupMembers (V2TIMGroupMemberSearchParam param, V2TIMValueCallback< HashMap< String, List< V2TIMGroupMemberFullInfo >>> callback)
 
abstract void setGroupMemberInfo (String groupID, V2TIMGroupMemberFullInfo info, V2TIMCallback callback)
 
abstract void muteGroupMember (String groupID, String userID, int seconds, V2TIMCallback callback)
 
abstract void muteAllGroupMembers (String groupID, boolean isMute, V2TIMCallback callback)
 
abstract void inviteUserToGroup (String groupID, List< String > userList, V2TIMValueCallback< List< V2TIMGroupMemberOperationResult >> callback)
 
abstract void kickGroupMember (String groupID, List< String > memberList, String reason, int duration, V2TIMValueCallback< List< V2TIMGroupMemberOperationResult >> callback)
 
abstract void setGroupMemberRole (String groupID, String userID, int role, V2TIMCallback callback)
 
abstract void markGroupMemberList (String groupID, List< String > memberIDList, int markType, boolean enableMark, V2TIMCallback callback)
 
abstract void transferGroupOwner (String groupID, String userID, V2TIMCallback callback)
 
abstract void kickGroupMember (String groupID, List< String > memberList, String reason, V2TIMValueCallback< List< V2TIMGroupMemberOperationResult >> callback)
 
abstract void getGroupApplicationList (V2TIMValueCallback< V2TIMGroupApplicationResult > callback)
 
abstract void acceptGroupApplication (V2TIMGroupApplication application, String reason, V2TIMCallback callback)
 
abstract void refuseGroupApplication (V2TIMGroupApplication application, String reason, V2TIMCallback callback)
 
abstract void setGroupApplicationRead (V2TIMCallback callback)
 
abstract void getJoinedCommunityList (V2TIMValueCallback< List< V2TIMGroupInfo >> callback)
 
abstract void createTopicInCommunity (String groupID, V2TIMTopicInfo topicInfo, V2TIMValueCallback< String > callback)
 
abstract void deleteTopicFromCommunity (String groupID, List< String > topicIDList, V2TIMValueCallback< List< V2TIMTopicOperationResult >> callback)
 
abstract void setTopicInfo (V2TIMTopicInfo topicInfo, V2TIMCallback callback)
 
abstract void getTopicInfoList (String groupID, List< String > topicIDList, V2TIMValueCallback< List< V2TIMTopicInfoResult >> callback)
 

Member Function Documentation

◆ createGroup()

abstract void createGroup ( V2TIMGroupInfo  info,
List< V2TIMCreateGroupMemberInfo memberList,
V2TIMValueCallback< String >  callback 
)
abstract

1.1 Create a custom group (the advanced version API allows you to specify initial group members)

Parameters
infoCustom group information, including the groupID, groupType, groupName, notification, introduction, and faceURL fields
memberListSpecify initial group members (Audio-video groups do not support specifying initial group members. Pass in null for memberList.)
Attention
  • Limited by backgroud service, the number of memberList must be less than or equal to 20.
  • For other limits, please see V2TIMManager.createGroup remarks.

◆ getJoinedGroupList()

abstract void getJoinedGroupList ( V2TIMValueCallback< List< V2TIMGroupInfo >>  callback)
abstract

1.2 Get the list of groups that the current user has joined

Attention
  • Audio-video groups (AVChatRoom) do not support this API.
  • This API implements frequency limit checks. It can be called by the SDK for up to 10 times per second. When the limit is exceeded, the error ERR_SDK_COMM_API_CALL_FREQUENCY_LIMIT (7008) is reported.

◆ getGroupsInfo()

abstract void getGroupsInfo ( List< String >  groupIDList,
V2TIMValueCallback< List< V2TIMGroupInfoResult >>  callback 
)
abstract

2.1 Pull group profiles

Parameters
groupIDListList of group IDs

◆ searchGroups()

abstract void searchGroups ( V2TIMGroupSearchParam  searchParam,
V2TIMValueCallback< List< V2TIMGroupInfo >>  callback 
)
abstract

2.2 Search for group profiles (supported only in 5.4.666 and later versions and need to buy Flagship Edition)

Parameters
searchParamSearch parameters

◆ setGroupInfo()

abstract void setGroupInfo ( V2TIMGroupInfo  info,
V2TIMCallback  callback 
)
abstract

2.3 Modify group profiles

◆ initGroupAttributes()

abstract void initGroupAttributes ( String  groupID,
HashMap< String, String >  attributes,
V2TIMCallback  callback 
)
abstract

2.4 Initialize group attributes (this operation will clear the existing group attribute list)

Attention
Use limits of attributes:
  • Group attribute is supported only for audio-video groups (AVChatRoom) by 6.7 and earlier versions.
  • Group attribute is supported for 4 group types (AVChatRoom、Public、Meeting、Work groups) at the same time in 6.8 and later versions.
  • Group attribute is supported for all group types except topics in 7.0 and later versions.
  • Up to 16 keys are supported, with a length limit of 32 bytes.
  • The length limit for value is 4 KB.
  • The total length limit for attributes (including keys and values) is 16 KB.
  • The initGroupAttributes, setGroupAttributes, and deleteGroupAttributes APIs each can be called by the SDK for up to 10 times per 5 seconds, and the 8511 error code will be called back if the limit is exceeded. The APIs each can be called by the backend for up to 5 times per second, and the 10049 error code will be called back if the limit is exceeded.
  • The getGroupAttributes API can be called by the SDK for up to 20 times per 5 seconds.
  • Starting from version 5.6, when you modify group attributes for the first time after the app is started, please call getGroupAttributes to pull the latest group attributes before you initiate the modification operation.
  • Starting from version 5.6, when multiple users modify the same group attributes at the same time, only the first user can execute successfully, and other users will receive the 10056 error code. After receiving this error code, please call getGroupAttributes to update the locally stored group attributes to the latest before you initiate the modification operation.

◆ setGroupAttributes()

abstract void setGroupAttributes ( String  groupID,
HashMap< String, String >  attributes,
V2TIMCallback  callback 
)
abstract

2.5 Set group attributes. (If the group attributes already exist, their values are updated. Otherwise, the group attributes are added.)

Attention
  • Group attribute is supported only for audio-video groups (AVChatRoom) by 6.7 and earlier versions.
  • Group attribute is supported for 4 group types (AVChatRoom、Public、Meeting、Work groups) at the same time in 6.8 and later versions.
  • Group attribute is supported for all group types except topics in 7.0 and later versions.

◆ deleteGroupAttributes()

abstract void deleteGroupAttributes ( String  groupID,
List< String >  keys,
V2TIMCallback  callback 
)
abstract

2.6 Delete specified group attributes (If null is passed in for keys, all group attributes are cleared.)

Attention
  • Group attribute is supported only for audio-video groups (AVChatRoom) by 6.7 and earlier versions.
  • Group attribute is supported for 4 group types (AVChatRoom、Public、Meeting、Work groups) at the same time in 6.8 and later versions.
  • Group attribute is supported for all group types except topics in 7.0 and later versions.

◆ getGroupAttributes()

abstract void getGroupAttributes ( String  groupID,
List< String >  keys,
V2TIMValueCallback< Map< String, String >>  callback 
)
abstract

2.7 Get specified group attributes (If null is passed in for keys, all group attributes are obtained.)

Attention
  • Group attribute is supported only for audio-video groups (AVChatRoom) by 6.7 and earlier versions.
  • Group attribute is supported for 4 group types (AVChatRoom、Public、Meeting、Work groups) at the same time in 6.8 and later versions.
  • Group attribute is supported for all group types except topics in 7.0 and later versions.

◆ getGroupOnlineMemberCount()

abstract void getGroupOnlineMemberCount ( String  groupID,
V2TIMValueCallback< Integer >  callback 
)
abstract

2.8 Get the number of online members of a group

Attention
Notes:
  • This API is only supported by audio-video groups(AVChatRoom) before IMSDK 7.3 version.
  • You can call this API for all kinds of groups in IMSDK 7.3 and later versions.

◆ setGroupCounters()

abstract void setGroupCounters ( String  groupID,
HashMap< String, Long >  counters,
V2TIMValueCallback< Map< String, Long >>  callback 
)
abstract

2.9 Set group counters (supported only in 7.0 and later versions)

Attention
  • If the group counters already exist, their values will be updated. Otherwise, the group counters will be added.
  • When group counter is set successfully, their newest information will be returned in the succ callback.
  • Group counter is supported for all group types except community and topics.

◆ getGroupCounters()

abstract void getGroupCounters ( String  groupID,
List< String >  keys,
V2TIMValueCallback< Map< String, Long >>  callback 
)
abstract

2.10 Get group counters (supported only in 7.0 and later versions)

Attention
  • If keys is empty or null, it means to obtain all counters in the group.
  • Group counter is supported for all group types except community and topics.

◆ increaseGroupCounter()

abstract void increaseGroupCounter ( String  groupID,
String  key,
long  value,
V2TIMValueCallback< Map< String, Long >>  callback 
)
abstract

2.11 Increase group counters (supported only in 7.0 and later versions)

Parameters
groupIDGroup ID
keyThe key of group counter
valueIncrement of group counter, the value will be updated as new_value = old_value + value
Attention
  • Callback of success,returns the value of the current counter after increment
  • If the key of the counters specified by the parameters already exist, their values will be increased directly according to the parameters. Otherwise, new counters will be added firstly with value 0, then their value will be increased by the parameters.
  • Group counter is supported for all group types except community and topics.

◆ decreaseGroupCounter()

abstract void decreaseGroupCounter ( String  groupID,
String  key,
long  value,
V2TIMValueCallback< Map< String, Long >>  callback 
)
abstract

2.12 Decrease group counters (supported only in 7.0 and later versions)

Parameters
groupIDGroup ID
keyThe key of group counter
valueDecrement of group counter, the value will be updated as new_value = old_value - value
Attention
  • Callback of success,returns the value of the current counter after decrement
  • If the key of the counters specified by the parameters already exist, their values will be decreased directly according to the parameters. Otherwise, new counters will be added firstly with value 0, then their value will be decreased by the parameters.
  • Group counter is supported for all group types except community and topics.

◆ getGroupMemberList()

abstract void getGroupMemberList ( String  groupID,
int  filter,
long  nextSeq,
V2TIMValueCallback< V2TIMGroupMemberInfoResult callback 
)
abstract

3.1 Get the group member list

Parameters
filterSpecify the group member type
  • V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_FILTER_ALL: all types
  • V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_FILTER_OWNER: group owner
  • V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_FILTER_ADMIN: group admin
  • V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_FILTER_COMMON: common group member
nextSeqPulling-by-page flag. It is set to 0 when the information is pulled for the first time. If the callback succeeds and nextSeq is not 0, pagination is needed. The value of this field is passed in for the next pull until the value becomes 0.
Attention
  • Restrictions for normal groups(Work, Meeting, Public):
  1. The filter field can only be set to the value defined in V2TIMGroupMemberFullInfo, then you can get the members of the corresponding role.
  • Restrictions for audio-video groups(AVChatRoom):
  1. If you set the filter to the value defined in V2TIMGroupMemberFullInfo, you will get all the members. The maximum number of group members supported is 1000, new members will be placed at the top of the list. You need to upgrade your package to premium edition and login in IM Console to enable the feature of "List of online audio-video group members"(supported only in 6.3 and later versions).
  2. If you set the filter to custom markType defined by yourself, you can get the members of the corresponding markType in the Flagship Edition. Please refer to the API markGroupMemberList to mark group member list.
  3. After the app is restarted, please join the group again. Otherwise, the 10007 error code will be reported when you pull the group member list.
  4. Only the following fields are supported in group member profiles: userID, nickName, faceURL, and role.
  • Restrictions for Community groups:
    1. If you set the filter to the value defined in V2TIMGroupMemberFullInfo, you will get the the members of corresponding role.
    2. If you set the filter to custom markType defined by yourself, you can get the members of the corresponding markType in the Flagship Edition. Please refer to the API markGroupMemberList to mark group member list(supported only in 7.5 and later versions).

◆ getGroupMembersInfo()

abstract void getGroupMembersInfo ( String  groupID,
List< String >  memberList,
V2TIMValueCallback< List< V2TIMGroupMemberFullInfo >>  callback 
)
abstract

3.2 Get the profiles of specified group members

◆ searchGroupMembers()

abstract void searchGroupMembers ( V2TIMGroupMemberSearchParam  param,
V2TIMValueCallback< HashMap< String, List< V2TIMGroupMemberFullInfo >>>  callback 
)
abstract

3.3 Search for group members (supported only in 5.4.666 and later versions and need to buy Flagship Edition)

Parameters
paramSearch parameters

◆ setGroupMemberInfo()

abstract void setGroupMemberInfo ( String  groupID,
V2TIMGroupMemberFullInfo  info,
V2TIMCallback  callback 
)
abstract

3.4 Modify the profiles of specified group members

◆ muteGroupMember()

abstract void muteGroupMember ( String  groupID,
String  userID,
int  seconds,
V2TIMCallback  callback 
)
abstract

3.5 Mute a specific group member (this API can be called by the admin or group owner)

Parameters
secondsTime period in seconds from calling this API which indicates how many seconds the mute user will be forbidden to speak.

◆ muteAllGroupMembers()

abstract void muteAllGroupMembers ( String  groupID,
boolean  isMute,
V2TIMCallback  callback 
)
abstract

3.6 Mute all group members (supported only in 7.5 and later versions)

Parameters
groupIDGroup ID
isMutetrue means mute, false means unmute
Attention
  • Only the group owner and admin can call this API.
  • You can set isMute to false to unmute all group members.
  • All group members will receive onAllGroupMembersMuted notification after this API is called successfully.
  • Sending messages to the group is forbidden for all group members if muted.

◆ inviteUserToGroup()

abstract void inviteUserToGroup ( String  groupID,
List< String >  userList,
V2TIMValueCallback< List< V2TIMGroupMemberOperationResult >>  callback 
)
abstract

3.7 Invite users to a group

Attention
The limits for different types of groups are as follows:
  • Work group (Work): Anyone in the group can invite others to the group.
  • Meeting group (Meeting) and public group (Public): Users are not allowed to join the group through invitation by default. You can modify the groupApproveOpt field of the V2TIMGroupInfo to open it. After that, all the group members can invite others to join in the group.
  • Audio-video group (AVChatRoom): Inviting users to a group is not supported.
  • Limited by backgroud service, the number of userList must be less than or equal to 20.

◆ kickGroupMember() [1/2]

abstract void kickGroupMember ( String  groupID,
List< String >  memberList,
String  reason,
int  duration,
V2TIMValueCallback< List< V2TIMGroupMemberOperationResult >>  callback 
)
abstract

3.8 Remove a member from a group

Parameters
groupIDGroup ID
memberListThe member list of kicked off
reasonThe reason why the member needed to kick off
durationTime interval during which the target users will not be allowed to join the group again after being kicked out of the group in seconds
succCallback
Attention
  • You can specificy a time interval in seconds during which the target users will not be allowed to join the group again after being kicked out of the group from 7.2 version.
  • Work group (Work): only the group owner or app admin can remove a member from a group.
  • Meeting group (Meeting) and public group (Public): the group owner, group admin, and app admin can remove a member from a group.
  • Audio-video group (AVChatRoom): only muting(muteGroupMember) is supported in versions prior to 6.6. Both muting(muteGroupMember) and kicking(kickGroupMember) are supported in 6.6 and later versions.
  • Please refer to the following link for other usage restrictions of this interface: https://cloud.tencent.com/document/product/269/75400#.E8.B8.A2.E4.BA.BA.

◆ setGroupMemberRole()

abstract void setGroupMemberRole ( String  groupID,
String  userID,
int  role,
V2TIMCallback  callback 
)
abstract

3.9 Set the role of a group member

Attention
The limits for different types of groups are as follows:
  • Meeting group (Meeting) and public group (Public): only the group owner can switch the role of a group member between common member and admin.
  • Other types of groups do not support group member role setting.
  • To transfer a group, please call the transferGroupOwner API.
  • For a meeting group (Meeting), after a group member role is set, there will be no onGrantAdministrator or onRevokeAdministrator callback.
  • Roles that can be set are common member (V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_ROLE_MEMBER) and admin (V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_ROLE_ADMIN).

◆ markGroupMemberList()

abstract void markGroupMemberList ( String  groupID,
List< String >  memberIDList,
int  markType,
boolean  enableMark,
V2TIMCallback  callback 
)
abstract

3.10 Mark group member(you need to buy Flagship Edition)

Parameters
groupIDGroup's identifier.
memberIDListGroup member's identifier list.
markTypeThe mark type is uint32_t, and the value must be equal or greater than 1000. You can customize it. A maximum of 10 marks are allowed to be defined in a group.
enableMarkSet or remove. true means setting the mark, and false means removing the mark.
Attention
Attention please:
  • Supported in Audio-video group (AVChatRoom) in 6.6 and later versions.
  • Supported in Community group in 7.5 and later versions.
  • Only the group owner has permission to mark other members in the group.

◆ transferGroupOwner()

abstract void transferGroupOwner ( String  groupID,
String  userID,
V2TIMCallback  callback 
)
abstract

3.11 Change the group owner

Attention
The limits for different types of groups are as follows:
  • Common groups (Work, Public, and Meeting): only the group owner has the permission to change the group owner.
  • Audio-video group (AVChatRoom): changing the group owner is not supported.

◆ kickGroupMember() [2/2]

abstract void kickGroupMember ( String  groupID,
List< String >  memberList,
String  reason,
V2TIMValueCallback< List< V2TIMGroupMemberOperationResult >>  callback 
)
abstract

3.12 Remove a member from a group(Removing a member from AVChatRoom is supported only in 6.6 and later versions and need to buy Flagship Edition)

Attention
The limits are as follows:
  • It is deprecated and discouraged to call this function. Please call API kickGroupMember(String, List<String>, String, int, V2TIMValueCallback) instead.
  • Work group (Work): only the group owner or app admin can remove a member from a group.
  • Meeting group (Meeting) and public group (Public): the group owner, group admin, and app admin can remove a member from a group.
  • Audio-video group (AVChatRoom): only muting(muteGroupMember) is supported in versions prior to 6.6. Both muting(muteGroupMember) and kicking(kickGroupMember) are supported in 6.6 and later versions.

◆ getGroupApplicationList()

abstract void getGroupApplicationList ( V2TIMValueCallback< V2TIMGroupApplicationResult callback)
abstract

4.1 Get the group joining request list

Attention
Up to 50 requests are supported

◆ acceptGroupApplication()

abstract void acceptGroupApplication ( V2TIMGroupApplication  application,
String  reason,
V2TIMCallback  callback 
)
abstract

4.2 Approve a group joining request

◆ refuseGroupApplication()

abstract void refuseGroupApplication ( V2TIMGroupApplication  application,
String  reason,
V2TIMCallback  callback 
)
abstract

4.3 Reject a group joining request

◆ setGroupApplicationRead()

abstract void setGroupApplicationRead ( V2TIMCallback  callback)
abstract

4.4 Mark the group joining request list as read

◆ getJoinedCommunityList()

abstract void getJoinedCommunityList ( V2TIMValueCallback< List< V2TIMGroupInfo >>  callback)
abstract

5.1 Get the list of Community-groups that the current user has joined

◆ createTopicInCommunity()

abstract void createTopicInCommunity ( String  groupID,
V2TIMTopicInfo  topicInfo,
V2TIMValueCallback< String >  callback 
)
abstract

5.2 Create topic

Parameters
groupIDThe community ID must start with @TGS_.

◆ deleteTopicFromCommunity()

abstract void deleteTopicFromCommunity ( String  groupID,
List< String >  topicIDList,
V2TIMValueCallback< List< V2TIMTopicOperationResult >>  callback 
)
abstract

5.3 Delete topic

◆ setTopicInfo()

abstract void setTopicInfo ( V2TIMTopicInfo  topicInfo,
V2TIMCallback  callback 
)
abstract

5.4 Modify topic information

◆ getTopicInfoList()

abstract void getTopicInfoList ( String  groupID,
List< String >  topicIDList,
V2TIMValueCallback< List< V2TIMTopicInfoResult >>  callback 
)
abstract

5.5 Get topic list

Attention
: When the topicIDList is empty,it means to get the list of all topics in this Community.