Get the blacklist
Use getBlacklist() to retrieve the current user blacklist.
The blacklist records users blocked by the current account. Use it for a blacklist settings screen, relationship state on a profile card, or to limit a chat entry point.
Get the blacklist
After SDK initialization and login, call getBlacklist() to retrieve the full blacklist for the signed-in account. An empty list means no users are blocked.
OpenIMClient.getInstance().friendshipManager.getBlacklist(
new OnBase<List<UserInfo>>() {
@Override
public void onSuccess(List<UserInfo> users) {
// Use users to update the blacklist.
}
@Override
public void onError(int code, String error) {
// Handle the error.
}
}
);The callback returns List<UserInfo>; call UserInfo.getBlackInfo() to retrieve the blacklist relationship object.
Blacklist record fields
Common BlacklistInfo fields are:
| Field | Description |
|---|---|
userID | Target user ID blocked by the current user. |
nickname | Target user nickname. |
faceURL | Target user avatar URL. |
gender | Target user gender value. |
operatorUserID | User ID that performed the block operation. |
createTime | Blacklist relationship creation time. |
addSource | Source that added the blacklist relationship. |
ex | Blacklist relationship extension string. |
When the screen also needs friend remarks or the latest public profile, query the corresponding friend or public profile data.
Receive blacklist changes through the listeners described in Block a user and Unblock a user.
Was this page helpful?