setFriendListener
Description
info
Set the relationship chain event listener to asynchronously callback and notify related events of relationship chain changes, so that the UI can perceive and process them in a timely manner.
Note
(1) Call immediately after initSDK;
(2) Can only be called once.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future setFriendshipListener(OnFriendshipListener listener)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| listener | OnFriendshipListener | Yes |
Return Result
~
Code Example
OpenIM.iMManager.friendshipManager.setFriendshipListener(OnFriendshipListener(
onBlacklistAdded: (BlacklistInfo i){},
onBlacklistDeleted: (BlacklistInfo i){},
onFriendAdded: (FriendInfo i){},
onFriendApplicationAccepted: (FriendApplicationInfo i){},
onFriendApplicationAdded: (FriendApplicationInfo i){},
onFriendApplicationDeleted: (FriendApplicationInfo i){},
onFriendApplicationRejected: (FriendApplicationInfo i){},
onFriendDeleted: (FriendInfo i){},
onFriendInfoChanged: (FriendInfo i){},
));
Function Prototype
- (void)addFriendListener:(id<OIMFriendshipListener>)listener NS_SWIFT_NAME(addFriendListener(listener:));
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| listener | id < OIMFriendshipListener > | Yes |
Return Result
None
Code Example
[OIMManager.callbacker addFriendListener:self];
Function Prototype
public void setOnFriendshipListener(OnFriendshipListener listener)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| listener | id <OnFriendshipListener> | Yes |
Return Result
None
Code Example
OpenIMClient.getInstance().friendshipManager.setOnFriendshipListener(new OnFriendshipListener{...} )
Note
Set automatically after successful login, you can directly use the listener in the client. For friend event details, see
Note
Set automatically after successful initialization. The callback will be passed to the client through globalEvent. For friend event details, see
Note
Set automatically after successful login, you can directly use the listener in the client. For friend event details, see
Function Prototype
public static void SetFriendShipListener(IFriendShipListener listener)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| listener | IFriendShipListener | Yes |
Return Result
None
Code Example
IMSDK.SetFriendShipListener(listener)