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.
V2TIMGroupInfo

Public Member Functions

 V2TIMGroupInfo ()
 
String getGroupID ()
 
void setGroupID (String groupID)
 
String getGroupType ()
 
void setGroupType (String groupType)
 
void setSupportTopic (boolean supportTopic)
 
boolean isSupportTopic ()
 
String getGroupName ()
 
void setGroupName (String groupName)
 
String getNotification ()
 
void setNotification (String notification)
 
String getIntroduction ()
 
void setIntroduction (String introduction)
 
String getFaceUrl ()
 
void setFaceUrl (String faceUrl)
 
boolean isAllMuted ()
 
void setAllMuted (boolean isAllMuted)
 
String getOwner ()
 
long getCreateTime ()
 
int getGroupAddOpt ()
 
void setGroupAddOpt (int addOpt)
 
int getGroupApproveOpt ()
 
void setGroupApproveOpt (int approveOpt)
 
void setCustomInfo (Map< String, byte[]> customInfoMap)
 
Map< String, byte[]> getCustomInfo ()
 
long getLastInfoTime ()
 
long getLastMessageTime ()
 
int getMemberCount ()
 
int getOnlineCount ()
 
long getMemberMaxCount ()
 
int getRole ()
 
int getRecvOpt ()
 
long getJoinTime ()
 
boolean isEnablePermissionGroup ()
 
void setEnablePermissionGroup (boolean enablePermissionGroup)
 
long getDefaultPermissions ()
 
void setDefaultPermissions (long defaultPermissions)
 

Static Public Attributes

static final int V2TIM_GROUP_ADD_FORBID = 0
 
static final int V2TIM_GROUP_ADD_AUTH = 1
 
static final int V2TIM_GROUP_ADD_ANY = 2
 

Constructor & Destructor Documentation

◆ V2TIMGroupInfo()

V2TIMGroupInfo ( )
inline

Member Function Documentation

◆ getGroupID()

String getGroupID ( )
inline

Get the group ID

Returns
Group ID

◆ setGroupID()

void setGroupID ( String  groupID)
inline

Set the group ID. This operation can be performed only during group creation.

Attention
The custom group ID must be printable ASCII characters (0x20-0x7e) with a maximum length of 48 bytes. It cannot begin with @TGS# so as to avoid confusion with the default group IDs assigned by IM.
Parameters
groupIDGroup ID

◆ getGroupType()

String getGroupType ( )
inline

Get the group type

Returns
Group type

◆ setGroupType()

void setGroupType ( String  groupType)
inline

Set the group type. This operation can be performed only during group creation.

Parameters
groupTypeGroup type

◆ setSupportTopic()

void setSupportTopic ( boolean  supportTopic)
inline

Set supporting topic of not. (valid only for Community)

◆ isSupportTopic()

boolean isSupportTopic ( )
inline

Get supporting topic of not. (valid only for Community)

◆ getGroupName()

String getGroupName ( )
inline

Get the group name

Returns
Group name

◆ setGroupName()

void setGroupName ( String  groupName)
inline

Set the group name. This operation can be performed only during group creation or group information modification.

Attention
The maximum length of the group name is 100 bytes, encoded in UTF-8.
Parameters
groupNameGroup name

◆ getNotification()

String getNotification ( )
inline

Get the group notice

◆ setNotification()

void setNotification ( String  notification)
inline

Set the group notice. This operation can be performed only during group creation or group information modification.

Attention
The maximum length of the group notice is 400 bytes, encoded in UTF-8.
Parameters
notificationGroup notice

◆ getIntroduction()

String getIntroduction ( )
inline

Get the group introduction

◆ setIntroduction()

void setIntroduction ( String  introduction)
inline

Set the group introduction. This operation can be performed only during group creation or group information modification.

Attention
The maximum length of the group introduction is 400 bytes, encoded in UTF-8.
Parameters
introductionGroup introduction

◆ getFaceUrl()

String getFaceUrl ( )
inline

Get the group profile photo URL

Returns
Group profile photo URL

◆ setFaceUrl()

void setFaceUrl ( String  faceUrl)
inline

Set the group profile photo URL. This operation can be performed only during group creation or group information modification.

Attention
The maximum length of the group profile photo URL is 500 bytes, encoded in UTF-8.
Parameters
faceUrlGroup profile photo URL

◆ isAllMuted()

boolean isAllMuted ( )
inline

Get whether the current group has muted all members

Returns
true - All members are muted

◆ setAllMuted()

void setAllMuted ( boolean  isAllMuted)
inline

Set whether to mute all group members. This operation can be performed only during group information modification.

Parameters
isAllMutedWhether to mute all group members

◆ getOwner()

String getOwner ( )
inline

Get the group owner

Returns
Group owner ID

◆ getCreateTime()

long getCreateTime ( )
inline

Get the group creation time

Returns
UTC timestamp of group creation

◆ getGroupAddOpt()

int getGroupAddOpt ( )
inline

Get the approval method of the administrator in the group applying mode

Returns

◆ setGroupAddOpt()

void setGroupAddOpt ( int  addOpt)
inline

Set the approval method of the administrator in the group applying mode, creating groups and modifying group information can be set. The default value of work group is V2TIM_ GROUP_ ADD_ FORBID (that is, users are not allowed to apply for group membership by default). You can modify this field to open it.

  • V2TIM_GROUP_ADD_FORBID: forbid anyone to join the group
  • V2TIM_GROUP_ADD_ANY: anyone can join the group
  • V2TIM_GROUP_ADD_AUTH: group owner or admin approval is required for group joining
Parameters
addOptAdmin approval options when applying to join a group

◆ getGroupApproveOpt()

int getGroupApproveOpt ( )
inline

Get the approval method of the administrator in the group invitation mode (Supported in 7.1 and later versions)

Returns

◆ setGroupApproveOpt()

void setGroupApproveOpt ( int  approveOpt)
inline

Set the approval method of the administrator in the group invitation mode, creating groups and modifying group information can be set. Except for work group, the default value of all other group types is V2TIM_ GROUP_ ADD_ FORBID (that is, users are not allowed to join the group through invitation). You can modify this field to open it. This field is not supported in AVChatRoom、Community and Topics.

  • V2TIM_GROUP_ADD_FORBID: forbid anyone to join the group
  • V2TIM_GROUP_ADD_ANY: anyone can join the group
  • V2TIM_GROUP_ADD_AUTH: group owner or admin approval is required for group joining
Parameters
approveOptAdmin approval option when inviting to a group

◆ setCustomInfo()

void setCustomInfo ( Map< String, byte[]>  customInfoMap)
inline

To set a custom group field, perform the following steps:

1. Go to the console (Feature Configuration -> Custom Group Field) to set the key value of the custom group field. The key field is of the String type, with a maximum length of 16 bytes.

2. Call the setGroupInfo API to set the field. The HashMap field value length does not exceed 512 bytes.

Attention
  • This field is mainly used for compatibility with V1 and V2. If you are using V2 APIs, you are advised to use the initGroupAttributes API to set group attributes because the API is more flexible (requiring no configuration in the console) and supports a larger storage capacity (up to 16 KB). You are advised to use the initGroupAttributes API to set group attributes because the API is more flexible (requiring no configuration in the console) and supports a larger storage capacity (up to 16 KB).
  • The parameter customInfoMap must be a hashmap object.

◆ getCustomInfo()

Map<String, byte[]> getCustomInfo ( )
inline

Get custom group fields

◆ getLastInfoTime()

long getLastInfoTime ( )
inline

UTC timestamp of the group information last modification

Returns

◆ getLastMessageTime()

long getLastMessageTime ( )
inline

Get the last time the group sends a message

Returns

◆ getMemberCount()

int getMemberCount ( )
inline

Get the number of members that have joined the group

Returns

◆ getOnlineCount()

int getOnlineCount ( )
inline

Get the number of online group members (It is deprecated, please call API getGroupOnlineMemberCount instead)

Returns

◆ getMemberMaxCount()

long getMemberMaxCount ( )
inline

Get the maximum number of group members allowed to join

Attention
For details on the number of members allowed for each group type, please see: https://intl.cloud.tencent.com/document/product/1047/33529

◆ getRole()

int getRole ( )
inline

Get the group member role. To switch the role, please call the setGroupMemberRole API.

Returns
Member roles: V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_UNDEFINED: non-member V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_ROLE_MEMBER: common member V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_ROLE_ADMIN: group admin V2TIMGroupMemberFullInfo.V2TIM_GROUP_MEMBER_ROLE_OWNER: group owner

◆ getRecvOpt()

int getRecvOpt ( )
inline

Get the current user's message receiving option in the group. To modify the group message receiving option, please call the setReceiveMessageOpt API.

Returns
Message receiving options: V2TIMMessage.V2TIM_RECEIVE_MESSAGE, V2TIMMessage.V2TIM_NOT_RECEIVE_MESSAGE, V2TIMMessage.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE V2TIMMessage.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE_EXCEPT_AT

◆ getJoinTime()

long getJoinTime ( )
inline

UTC timestamp when the current user joined this group. The time is automatically generated by the system and cannot be set.

Returns
Group joining time, in seconds

◆ isEnablePermissionGroup()

boolean isEnablePermissionGroup ( )
inline

Get enable permission group field, only supports community from 7.8 version

◆ setEnablePermissionGroup()

void setEnablePermissionGroup ( boolean  enablePermissionGroup)
inline

Set enable permission group field, only supports community from 7.8 version

Attention
When this feature is enabled, the administrator role will lose its permissions, and you will need to use group default permissions, topic default permissions, and permission groups to manage the group and topic.

◆ getDefaultPermissions()

long getDefaultPermissions ( )
inline

Get default permissions, only supports community from 7.8 version

◆ setDefaultPermissions()

void setDefaultPermissions ( long  defaultPermissions)
inline

Set default permissions, only supports community from 7.8 version

Attention
When the permission group is enabled (enablePermissionGroup = true), the default permissions for group members who have not joined any permission groups will take effect.

Field Documentation

◆ V2TIM_GROUP_ADD_FORBID

final int V2TIM_GROUP_ADD_FORBID = 0
static

Forbid anyone to join the group

◆ V2TIM_GROUP_ADD_AUTH

final int V2TIM_GROUP_ADD_AUTH = 1
static

Require admin approval

◆ V2TIM_GROUP_ADD_ANY

final int V2TIM_GROUP_ADD_ANY = 2
static

Anyone can join