SDKsAndroidEnterprise
Set friend request permissions
Configure verification rules for incoming friend requests targeting the authenticated account.
Configure how the server handles incoming friend applications sent by other users (such as requiring manual approval, auto-accepting, or rejecting all incoming requests). This capability belongs to the Commercial Edition.
Set the permission enum code in the user configuration request, then submit it via Update the current user profile:
Code example
UserInfoReq request = new UserInfoReq();
request.setAddFriendPermission(AddFriendPermission.Allow.getValue());
OpenIMClient.getInstance().userInfoManager.setSelfInfo(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Friend request permissions updated successfully
}
@Override
public void onError(int code, String error) {
// Handle error
}
},
request
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
request | UserInfoReq | Yes | User profile request payload containing the friend permission enum value. |
Permission modes
| Enum constant | Value | Description |
|---|---|---|
AddFriendPermission.Allow | 0 | Allows users to send friend requests, requiring manual review and approval by the recipient. |
AddFriendPermission.AllowNoReview | 1 | Automatically accepts incoming friend requests without manual approval. |
AddFriendPermission.Deny | 2 | Disallows any incoming friend requests to the account. |
Return value
Upon success, data in onSuccess returns a confirmation message.
State changes after the call
- Callback confirmation: The
onSuccesscallback indicates that the server recorded the updated friend request permission. - Scope of effect: This setting applies strictly to incoming friend requests initiated after the update. It does not alter existing friendships or auto-resolve pending friend applications.
- Asynchronous event delivery: The current account receives
OnUserListener.onSelfInfoUpdatedreflecting the updated user profile configuration. - Re-query calibration: To review pending friend applications, see Get received friend applications.
Was this page helpful?