setGroupListener
Feature Introduction
Description
Set the group event listener to asynchronously notify related group changes, allowing the UI to perceive and handle them promptly.
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 setGroupListener(OnGroupListener listener)
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
listener | OnGroupListener | Required |
Code Example
OpenIM.iMManager.groupManager.setGroupListener(OnGroupListener(
onGroupApplicationAccepted: (GroupApplicationInfo info){},
onGroupApplicationAdded: (GroupApplicationInfo info){},
onGroupApplicationDeleted: (GroupApplicationInfo info){},
onGroupApplicationRejected: (GroupApplicationInfo info){},
onGroupInfoChanged: (GroupInfo info){},
onGroupMemberAdded: (GroupMembersInfo info){},
onGroupMemberDeleted: (GroupMembersInfo info){},
onGroupMemberInfoChanged: (GroupMembersInfo info){},
onJoinedGroupAdded: (GroupInfo info){},
onJoinedGroupDeleted: (GroupInfo info){},
));
Function Prototype
- (void)addGroupListener:(id<OIMGroupListener>)listener NS_SWIFT_NAME(addGroupListener(listener:));
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
listener | id < GroupListener > | Required |
Code Example
[OIMManager.callbacker addGroupListener:self];
Function Prototype
public void setOnGroupListener(OnGroupListener listener)
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
listener | OnGroupListener | Yes | Callback |
Return Result
Code Example
OpenIMClient.getInstance().groupManager.setOnGroupListener(new OnGroupListener() {
@Override
public void onGroupApplicationAccepted(GroupApplicationInfo info) {
}
@Override
public void onGroupApplicationAdded(GroupApplicationInfo info) {
}
@Override
public void onGroupApplicationDeleted(GroupApplicationInfo info) {
}
@Override
public void onGroupApplicationRejected(GroupApplicationInfo info) {
}
@Override
public void onGroupInfoChanged(GroupInfo info) {
}
@Override
public void onGroupMemberAdded(GroupMembersInfo info) {
}
@Override
public void onGroupMemberDeleted(GroupMembersInfo info) {
}
@Override
public void onGroupMemberInfoChanged(GroupMembersInfo info) {
}
@Override
public void onJoinedGroupAdded(GroupInfo info) {
}
@Override
public void onJoinedGroupDeleted(GroupInfo info) {
}
});
Note
Set automatically after successful login. Directly use the listener in the client. See group event details here
Note
Automatically set after successful initialization. The callback will be passed to the client via globalEvent
. See group event details here
Attention
After successful initialization, it's set automatically. You can directly use the listener on the client side. Details on group events can be found here
Function Prototype
public static void SetGroupListener(IGroupListener l)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
l | IGroupListener | Yes | Callback |
Return Result
Code Example
IMSDK.SetGroupListener(IGroupListener l);