Browse SDKs · Android
SDKsAndroid

Delete a friend

Use deleteFriend() to remove one friendship from the current user.

Copy
OpenIMClient.getInstance().friendshipManager.deleteFriend(
    new OnBase<String>() {
        @Override
        public void onSuccess(String data) {
            markFriendDeletionSubmitted(friendUserID);
        }

        @Override
        public void onError(int code, String error) {
            recordFriendDeletionFailure(code, error);
        }
    },
    friendUserID
);

A successful callback means the delete request completed. Remove the local record by userID after onFriendDeleted arrives. Event handling is documented in Get the friend list by page.