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

Public Member Functions

abstract void setFriendListener (V2TIMFriendshipListener listener)
 
abstract void addFriendListener (V2TIMFriendshipListener listener)
 
abstract void removeFriendListener (V2TIMFriendshipListener listener)
 
abstract void getFriendList (V2TIMValueCallback< List< V2TIMFriendInfo >> callback)
 
abstract void getFriendsInfo (List< String > userIDList, V2TIMValueCallback< List< V2TIMFriendInfoResult >> callback)
 
abstract void setFriendInfo (V2TIMFriendInfo info, V2TIMCallback callback)
 
abstract void searchFriends (V2TIMFriendSearchParam searchParam, V2TIMValueCallback< List< V2TIMFriendInfoResult >> callback)
 
abstract void addFriend (V2TIMFriendAddApplication application, V2TIMValueCallback< V2TIMFriendOperationResult > callback)
 
abstract void deleteFromFriendList (List< String > userIDList, int deleteType, V2TIMValueCallback< List< V2TIMFriendOperationResult >> callback)
 
abstract void checkFriend (List< String > userIDList, int checkType, V2TIMValueCallback< List< V2TIMFriendCheckResult >> callback)
 
abstract void getFriendApplicationList (V2TIMValueCallback< V2TIMFriendApplicationResult > callback)
 
abstract void acceptFriendApplication (V2TIMFriendApplication application, int responseType, V2TIMValueCallback< V2TIMFriendOperationResult > callback)
 
abstract void refuseFriendApplication (V2TIMFriendApplication application, V2TIMValueCallback< V2TIMFriendOperationResult > callback)
 
abstract void deleteFriendApplication (V2TIMFriendApplication application, V2TIMCallback callback)
 
abstract void setFriendApplicationRead (V2TIMCallback callback)
 
abstract void addToBlackList (List< String > userIDList, V2TIMValueCallback< List< V2TIMFriendOperationResult >> callback)
 
abstract void deleteFromBlackList (List< String > userIDList, V2TIMValueCallback< List< V2TIMFriendOperationResult >> callback)
 
abstract void getBlackList (V2TIMValueCallback< List< V2TIMFriendInfo >> callback)
 
abstract void createFriendGroup (String groupName, List< String > userIDList, final V2TIMValueCallback< List< V2TIMFriendOperationResult >> callback)
 
abstract void getFriendGroups (List< String > groupNameList, final V2TIMValueCallback< List< V2TIMFriendGroup >> callback)
 
abstract void deleteFriendGroup (List< String > groupNameList, final V2TIMCallback callback)
 
abstract void renameFriendGroup (String oldName, String newName, V2TIMCallback callback)
 
abstract void addFriendsToFriendGroup (String groupName, List< String > userIDList, V2TIMValueCallback< List< V2TIMFriendOperationResult >> callback)
 
abstract void deleteFriendsFromFriendGroup (String groupName, List< String > userIDList, V2TIMValueCallback< List< V2TIMFriendOperationResult >> callback)
 

Detailed Description

Relationship chain APIs, including the APIs for adding and deleting friends as well as blocklisting/unblocklisting

Member Function Documentation

◆ setFriendListener()

abstract void setFriendListener ( V2TIMFriendshipListener  listener)
abstract

1.1 Set the relationship chain listener

◆ addFriendListener()

abstract void addFriendListener ( V2TIMFriendshipListener  listener)
abstract

1.2 Add the relationship chain listener

◆ removeFriendListener()

abstract void removeFriendListener ( V2TIMFriendshipListener  listener)
abstract

1.3 Remove the relationship chain listener

◆ getFriendList()

abstract void getFriendList ( V2TIMValueCallback< List< V2TIMFriendInfo >>  callback)
abstract

2.1 Get the friend list

◆ getFriendsInfo()

abstract void getFriendsInfo ( List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFriendInfoResult >>  callback 
)
abstract

2.2 Get the profiles of specified friends

Parameters
userIDListList of friends' userIDs
  • You are advised to obtain a maximum of 100 user IDs at a time. A larger number may cause the request to be rejected by the backend due to an excessively large data packet. The maximum size of a data packet supported by the backend is 1 MB.

◆ setFriendInfo()

abstract void setFriendInfo ( V2TIMFriendInfo  info,
V2TIMCallback  callback 
)
abstract

2.3 Set the profile of a specified friend

◆ searchFriends()

abstract void searchFriends ( V2TIMFriendSearchParam  searchParam,
V2TIMValueCallback< List< V2TIMFriendInfoResult >>  callback 
)
abstract

2.4 Search for friends (supported only in 5.4.666 and later versions and need to buy Flagship Edition)

Attention
The API returns the user information stored locally. You can determine whether the user is a friend via getRelation in V2TIMFriendInfoResult.

◆ addFriend()

abstract void addFriend ( V2TIMFriendAddApplication  application,
V2TIMValueCallback< V2TIMFriendOperationResult callback 
)
abstract

2.5 Add a friend

◆ deleteFromFriendList()

abstract void deleteFromFriendList ( List< String >  userIDList,
int  deleteType,
V2TIMValueCallback< List< V2TIMFriendOperationResult >>  callback 
)
abstract

2.6 Delete friends

Parameters
userIDListList of the friend userIDs to be deleted
  • You are advised to obtain a maximum of 100 user IDs at a time. A larger number may cause the request to be rejected by the backend due to an excessively large data packet. The maximum size of a data packet supported by the backend is 1 MB.
deleteTypeDeletion type
  • V2TIMFriendInfo.V2TIM_FRIEND_TYPE_SINGLE: one-way friend
  • V2TIMFriendInfo.V2TIM_FRIEND_TYPE_BOTH: two-way friend

◆ checkFriend()

abstract void checkFriend ( List< String >  userIDList,
int  checkType,
V2TIMValueCallback< List< V2TIMFriendCheckResult >>  callback 
)
abstract

2.7 Check your relationships with specified users

Parameters
userIDListList of the userIDs to be checked
checkTypeCheck type (one-way or two-way friend check)
Attention
Notes for using checkType:
  • If V2TIM_FRIEND_TYPE_SINGLE is passed in for checkType, the possible results are V2TIM_FRIEND_RELATION_TYPE_NONE and V2TIM_FRIEND_RELATION_TYPE_IN_MY_FRIEND_LIST.
  • If V2TIM_FRIEND_TYPE_BOTH is passed in for checkType, the possible results are V2TIM_FRIEND_RELATION_TYPE_NONE, V2TIM_FRIEND_RELATION_TYPE_IN_MY_FRIEND_LIST, V2TIM_FRIEND_RELATION_TYPE_IN_OTHER_FRIEND_LIST, and V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY. V2TIM_FRIEND_RELATION_TYPE_IN_OTHER_FRIEND_LIST、V2TIM_FRIEND_RELATION_TYPE_BOTH_WAY 四种情况

◆ getFriendApplicationList()

abstract void getFriendApplicationList ( V2TIMValueCallback< V2TIMFriendApplicationResult callback)
abstract

3.1 Get the friend request list

Attention
The friend request list includes the friend requests sent and received by yourself.

◆ acceptFriendApplication()

abstract void acceptFriendApplication ( V2TIMFriendApplication  application,
int  responseType,
V2TIMValueCallback< V2TIMFriendOperationResult callback 
)
abstract

3.2 Accept friend requests

Parameters
applicationFriend request information, which will be returned when calling getFriendApplicationList is successful
responseTypeBuild one-way or two-way friend relationships
  • V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE: agree to add as a one-way friend
  • V2TIMFriendApplication.V2TIM_FRIEND_ACCEPT_AGREE_AND_ADD: agree to add as a two-way friend

◆ refuseFriendApplication()

abstract void refuseFriendApplication ( V2TIMFriendApplication  application,
V2TIMValueCallback< V2TIMFriendOperationResult callback 
)
abstract

3.3 Reject friend requests

Parameters
applicationFriend request information, which will be returned when calling getFriendApplicationList is successful

◆ deleteFriendApplication()

abstract void deleteFriendApplication ( V2TIMFriendApplication  application,
V2TIMCallback  callback 
)
abstract

3.4 Delete friend requests

Parameters
applicationFriend request information, which will be returned when calling getFriendApplicationList is successful

◆ setFriendApplicationRead()

abstract void setFriendApplicationRead ( V2TIMCallback  callback)
abstract

3.5 Set a friend request as read

◆ addToBlackList()

abstract void addToBlackList ( List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFriendOperationResult >>  callback 
)
abstract

4.1 Add users to the blocklist

◆ deleteFromBlackList()

abstract void deleteFromBlackList ( List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFriendOperationResult >>  callback 
)
abstract

4.2 Delete users from the blocklist

◆ getBlackList()

abstract void getBlackList ( V2TIMValueCallback< List< V2TIMFriendInfo >>  callback)
abstract

4.3 Get the blocklist

◆ createFriendGroup()

abstract void createFriendGroup ( String  groupName,
List< String >  userIDList,
final V2TIMValueCallback< List< V2TIMFriendOperationResult >>  callback 
)
abstract

5.1 Create a friend list

Parameters
groupNameFriend list name
userIDListList of the friend userIDs to be added to the friend list

◆ getFriendGroups()

abstract void getFriendGroups ( List< String >  groupNameList,
final V2TIMValueCallback< List< V2TIMFriendGroup >>  callback 
)
abstract

5.2 Get friend list information

Parameters
groupNameListList of the names of the friend lists whose information is to be obtained. If null is passed in, the information of all friend lists is obtained.

◆ deleteFriendGroup()

abstract void deleteFriendGroup ( List< String >  groupNameList,
final V2TIMCallback  callback 
)
abstract

5.3 Delete friend lists

◆ renameFriendGroup()

abstract void renameFriendGroup ( String  oldName,
String  newName,
V2TIMCallback  callback 
)
abstract

Modify the name of a friend list

Parameters
oldNameOld name of the friend list
newNameNew name of the friend list
callbackCallback

◆ addFriendsToFriendGroup()

abstract void addFriendsToFriendGroup ( String  groupName,
List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFriendOperationResult >>  callback 
)
abstract

5.4 Add friends to a friend list

◆ deleteFriendsFromFriendGroup()

abstract void deleteFriendsFromFriendGroup ( String  groupName,
List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFriendOperationResult >>  callback 
)
abstract

5.5 Delete friends from a friend list