setConversationListener
Feature Introduction
Description
Set the conversation listener, including new conversations, conversation data changes, etc., for asynchronous notifications to the UI layer.
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
After a successful login, it's set automatically. You can directly use the listener on the client side. Details on conversation events can be found here.
Note
After successful initialization, it's set automatically. Callbacks will be passed to the client through globalEvent
. Details on conversation events can be found here.
Attention
After successful initialization, it's set automatically. You can directly use the listener on the client side. Details on conversation events can be found here
Function Prototype
public static void SetConversationListener(IConversationListener l)
Return Result
Parameter Name | Parameter Type | Description | |
---|---|---|---|
l | IConversationListener | Yes |
Code Example
IMSDK.SetConversationListener(listener);