Browse SDKs · Android
SDKsAndroid

Unblock a user

Use removeBlacklist() to remove a user from the current account blacklist.

Copy
OpenIMClient.getInstance().friendshipManager.removeBlacklist(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            markBlacklistRemovalSubmitted(targetUserID);
        }

        @Override
        public void onError(int code, String error) {
            recordBlacklistRemovalFailure(code, error);
        }
    },
    targetUserID
);

A successful callback means the remove request completed, not that the event has arrived. Remove the local entry after onBlacklistDeleted; if the event is missed, reconcile through Get the blacklist.

This page owns onBlacklistDeleted; remove the local entry by userID:

@Override
public void onBlacklistDeleted(BlacklistInfo user) {
    blacklistStore.remove(user.getUserID());
}