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 during group creation.

Attention
A custom group ID must be printable ASCII characters (0x20-0x7e) with a maximum length of 48 bytes. To avoid confusion with the default group IDs assigned by Chat, do not start the custom ID with @TGS.
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

Whether to enable topic creation for a community group

◆ isSupportTopic()

boolean isSupportTopic ( )
inline

Get whether a community group supports topic creation

◆ 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 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 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 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 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 whether admin approval is required to join the group

Returns

◆ setGroupAddOpt()

void setGroupAddOpt ( int  addOpt)
inline

Set the approval method for new members. This API can be called during group creation or group information modification. For work groups, the default value is V2TIM_GROUP_ADD_FORBID (users cannot request to join the group), which can be modified.

  • 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
addOptThe approval method for new group members

◆ getGroupApproveOpt()

int getGroupApproveOpt ( )
inline

Get whether admin approval is required to invite new members (supported in 7.1 and later versions)

Returns

◆ setGroupApproveOpt()

void setGroupApproveOpt ( int  approveOpt)
inline

Set the approval method for inviting new group members. This API can be called during group creation or group information modification. Except for work groups, the default value for all group types is V2TIM_GROUP_ADD_FORBID (no one can be invited to the group). For AVChatRoom, Community, and topics, the default value cannot be modified.

  • 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
approveOptThe approval method for inviting new group members

◆ setCustomInfo()

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

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

1. Go to the console (Configuration -> Group configuration -> Custom Group Field) to set the key (string, max 16 bytes) of the custom group field.

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

Attention
  • This field mainly serves to make V1 and V2 compatible with each other. If you are using V2, we recommend you use the initGroupAttributes API to set group attributes. It is more flexible to use, does not require console configuration, and supports a larger size (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

Get the UTC timestamp when the group information was last modified

Returns

◆ getLastMessageTime()

long getLastMessageTime ( )
inline

Get the last time a message was sent in the group

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 (This has been deprecated. Please call 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 seehere.

◆ 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

Get the time when the current user joined the group. The time is automatically generated by the system and cannot be modified.

Returns
Group joining time, in seconds

◆ isEnablePermissionGroup()

boolean isEnablePermissionGroup ( )
inline

Get whether permission groups are enabled (only supported for community groups since v7.8)

◆ setEnablePermissionGroup()

void setEnablePermissionGroup ( boolean  enablePermissionGroup)
inline

Whether to enable permission groups (only supported for community groups since v7.8)

Attention
When permission groups are enabled, admin permissions will become invalid, and communities and topics will be managed by group permissions, topic permissions, and permission groups.

◆ getDefaultPermissions()

long getDefaultPermissions ( )
inline

Get the default permissions (only supported for community groups since v7.8)

◆ setDefaultPermissions()

void setDefaultPermissions ( long  defaultPermissions)
inline

Set the default permissions (only supported for community groups since v7.8)

Attention
This API sets the default permissions for group members who have not joined any permission groups (only when permission groups are enabled, i.e., enablePermissionGroup = true).

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