SDKsAndroid
Remove from blacklist
Unblock a specified user and remove them from the authenticated account blocklist using removeBlacklist().
Remove a specified user from the authenticated account's blocklist. Once unblocked, the target user can send direct messages to the authenticated account again.
Code example
OpenIMClient.getInstance().friendshipManager.removeBlacklist(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// User unblocked successfully
}
@Override
public void onError(int code, String error) {
// Handle error
}
},
targetUserID
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
targetUserID | String | Yes | Target user ID to unblock. |
Return value
The successful callback indicates that the server removed the user from the blocklist.
State changes after the call
Once the unblock operation takes effect, the SDK triggers the onBlacklistDeleted(BlacklistInfo user) event via OnFriendshipListener. Locate and remove the entry matching user.getUserID() from your local blocklist dataset:
@Override
public void onBlacklistDeleted(BlacklistInfo user) {
// Received unblock event; delete entry matching user.getUserID() from local cache
}For complete listener registration details, see Get the blacklist.
Was this page helpful?