SDKsAndroid
Get the blacklist
Retrieve the complete list of blocked users for the authenticated account using getBlacklist().
Retrieve the full list of users blocked by the authenticated account. This is typically used in privacy settings to manage blocked accounts or on user profile cards to render a "Blocked" state.
Code example
OpenIMClient.getInstance().friendshipManager.getBlacklist(
new OnBase<List<UserInfo>>() {
@Override
public void onSuccess(List<UserInfo> users) {
// Update blocked users list UI using users
}
@Override
public void onError(int code, String error) {
// Handle error
}
}
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<List<UserInfo>> | Yes | Callback delivering the asynchronous operation result. |
Return value
The successful callback returns a List<UserInfo>. If no users are blocked, an empty list is returned. Deduplicate and cache items using userID as the unique key.
Access BlacklistInfo on each UserInfo object via the blackInfo property:
| Field | Description |
|---|---|
userID | User ID of the blocked user. |
nickname | Display nickname of the blocked user. |
faceURL | Avatar URL of the blocked user. |
gender | Gender indicator of the blocked user. |
operatorUserID | User ID of the operator who executed the block. |
createTime | Unix timestamp when the user was added to the blocklist. |
addSource | Channel or origin of the block operation. |
ex | Custom blocklist extension metadata. |
When users are added to or removed from the blocklist, the SDK dispatches events via OnFriendshipListener; see Add to blacklist and Remove from blacklist.
Was this page helpful?