SDKsAndroidEnterprise
Set friend request permissions
Choose how friend requests sent to the current account are handled.
Use addFriendPermission to choose whether requests from other users to add the current account require approval. This capability is available in the Enterprise edition.
Set the value with UserInfoReq.setAddFriendPermission(), then call setSelfInfo():
UserInfoReq request = new UserInfoReq();
request.setAddFriendPermission(AddFriendPermission.Allow.getValue());
OpenIMClient.getInstance().userInfoManager.setSelfInfo(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Friend request permission updated.
}
@Override
public void onError(int code, String error) {
// Handle the error.
}
},
request
);Permission values
| Enum value | Numeric value | Meaning |
|---|---|---|
AddFriendPermission.Allow | 0 | Allow requests, but require the current user to approve them. |
AddFriendPermission.AllowNoReview | 1 | Allow requests and create the friendship without approval. |
AddFriendPermission.Deny | 2 | Do not allow other users to add the current account. |
A successful callback means that the update request completed. This setting affects subsequent attempts to add the account; it does not remove existing friendships or process friend requests that already exist.
Was this page helpful?