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

Detailed Description

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

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 acceptFriendApplication (V2TIMFriendApplication application, int responseType, String remark, 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)
 
abstract void subscribeOfficialAccount (String officialAccountID, V2TIMCallback callback)
 
abstract void unsubscribeOfficialAccount (String officialAccountID, V2TIMCallback callback)
 
abstract void getOfficialAccountsInfo (List< String > officialAccountIDList, V2TIMValueCallback< List< V2TIMOfficialAccountInfoResult >> callback)
 
abstract void followUser (List< String > userIDList, V2TIMValueCallback< List< V2TIMFollowOperationResult >> callback)
 
abstract void unfollowUser (List< String > userIDList, V2TIMValueCallback< List< V2TIMFollowOperationResult >> callback)
 
abstract void getMyFollowingList (String nextCursor, V2TIMValueCallback< V2TIMUserInfoResult > callback)
 
abstract void getMyFollowersList (String nextCursor, V2TIMValueCallback< V2TIMUserInfoResult > callback)
 
abstract void getMutualFollowersList (String nextCursor, V2TIMValueCallback< V2TIMUserInfoResult > callback)
 
abstract void getUserFollowInfo (List< String > userIDList, V2TIMValueCallback< List< V2TIMFollowInfo >> callback)
 
abstract void checkFollowType (List< String > userIDList, V2TIMValueCallback< List< V2TIMFollowTypeCheckResult >> callback)
 

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 Chat Premium 5.4.666 and later versions)

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

◆ 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.
  • Up to 100 requests are supported.

◆ acceptFriendApplication() [1/2]

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

◆ acceptFriendApplication() [2/2]

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

3.3 Accept friend requests and set a remark

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
remarkFriend remark,maximum 96 bytes

◆ refuseFriendApplication()

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

3.4 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.5 Delete friend requests

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

◆ setFriendApplicationRead()

abstract void setFriendApplicationRead ( V2TIMCallback  callback)
abstract

3.6 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

◆ subscribeOfficialAccount()

abstract void subscribeOfficialAccount ( String  officialAccountID,
V2TIMCallback  callback 
)
abstract

6.1 Subscribe to an official account.(supported only in 7.6 and later versions)

◆ unsubscribeOfficialAccount()

abstract void unsubscribeOfficialAccount ( String  officialAccountID,
V2TIMCallback  callback 
)
abstract

6.2 Unsubscribe from an official account..(supported only in 7.6 and later versions)

◆ getOfficialAccountsInfo()

abstract void getOfficialAccountsInfo ( List< String >  officialAccountIDList,
V2TIMValueCallback< List< V2TIMOfficialAccountInfoResult >>  callback 
)
abstract

6.3 Get a list of official accounts.(supported only in 7.6 and later versions)

Parameters
officialAccountIDListList of official account IDs.
Attention
When the officialAccountIDList is empty,it means to get the list of subscribed official accounts.

◆ followUser()

abstract void followUser ( List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFollowOperationResult >>  callback 
)
abstract

7.1 Follow users (supported only in Chat Premium 7.8 and later versions)

Attention
The maximum number of users you can follow at one time is 20.

◆ unfollowUser()

abstract void unfollowUser ( List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFollowOperationResult >>  callback 
)
abstract

7.2 Unfollow users (supported only in Chat Premium 7.8 and later versions)

Attention
The maximum number of users you can unfollow at one time is 20.

◆ getMyFollowingList()

abstract void getMyFollowingList ( String  nextCursor,
V2TIMValueCallback< V2TIMUserInfoResult callback 
)
abstract

7.3 Get a list of the users I follow (supported only in Chat Premium 7.8 and later versions)

Parameters
nextCursorPulling-by-page flag. It can be set to null or "" when the information is pulled for the first time. If the API is called successfully and nextCursor returned by the callback is not "", the results are paginated. The value of this field should be passed in for the next pulling until nextCursor becomes "".

◆ getMyFollowersList()

abstract void getMyFollowersList ( String  nextCursor,
V2TIMValueCallback< V2TIMUserInfoResult callback 
)
abstract

7.4 Get a list of my followers (supported only in Chat Premium 7.8 and later versions)

Parameters
nextCursorPulling-by-page flag. It can be set to null or "" when the information is pulled for the first time. If the API is called successfully and nextCursor returned by the callback is not "", the results are paginated. The value of this field should be passed in for the next pulling until nextCursor becomes "".

◆ getMutualFollowersList()

abstract void getMutualFollowersList ( String  nextCursor,
V2TIMValueCallback< V2TIMUserInfoResult callback 
)
abstract

7.5 Get a list of my mutual followers (supported only in Chat Premium 7.8 and later versions)

Parameters
nextCursorPulling-by-page flag. It can be set to null or "" when the information is pulled for the first time. If the API is called successfully and nextCursor returned by the callback is not "", the results are paginated. The value of this field should be passed in for the next pulling until nextCursor becomes "".

◆ getUserFollowInfo()

abstract void getUserFollowInfo ( List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFollowInfo >>  callback 
)
abstract

7.6 Get the follow info of specified users (supported only in Chat Premium 7.8 and later versions)

◆ checkFollowType()

abstract void checkFollowType ( List< String >  userIDList,
V2TIMValueCallback< List< V2TIMFollowTypeCheckResult >>  callback 
)
abstract

7.7 Check follow type of specified users (supported only in Chat Premium 7.8 and later versions)