setConversationListener
Description
info
Set a conversation listener to asynchronously notify the UI layer of new conversations, conversation data changes, etc.
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 setConversationListener(OnConversationListener listener)
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| listener | ConversationListener | Yes |
Code Example
Function Prototype
- (void)addConversationListener:(id<OIMConversationListener>)listener NS_SWIFT_NAME(addConversationListener(listener:));
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| listener | id < ConversationListener > | Yes |
Code Example
[OIMManager.callbacker addConversationListener:self];
Function Prototype
public void setOnConversationListener(OnConversationListener listener)
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| listener | ConversationListener | Yes |
Code Example
OpenIMClient.getInstance().conversationManager.setOnConversationListener(new OnConversationListener() {
@Override
public void onConversationChanged(List<ConversationInfo> list) {
}
@Override
public void onNewConversation(List<ConversationInfo> list) {
}
@Override
public void onSyncServerFailed() {
}
@Override
public void onSyncServerFinish() {
}
@Override
public void onSyncServerStart() {
}
@Override
public void onTotalUnreadMessageCountChanged(int i) {
}
});
Note
Set automatically after successful login. Can be used directly, see conversation events details
Note
Set automatically after successful initialization. Callbacks will be passed to the client via globalEvent, see conversation events details
Note
Set automatically after successful login. Can be used directly, see conversation events details
Function Prototype
public static void SetConversationListener(IConversationListener l)
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| l | IConversationListener | Yes |
Code Example
IMSDK.SetConversationListener(listener);