SDKsAndroid
Accept a friend application
Approve a friend request from a specified user and establish a bilateral friendship using acceptFriendApplication().
Accept an incoming friend request from a specified user to establish a bilateral friendship.
Code example
OpenIMClient.getInstance().friendshipManager.acceptFriendApplication(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Friend application accepted successfully
}
@Override
public void onError(int code, String error) {
// Handle error
}
},
applicantUserID,
"Accepted"
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
applicantUserID | String | Yes | User ID of the applicant who submitted the request. |
handleMsg | String | No | Optional approval note attached to the resolution. |
Return value
The successful callback indicates that the server recorded the acceptance and established a bilateral friendship between the accounts.
State changes after the call
Upon acceptance, the SDK delivers events through OnFriendshipListener:
onFriendApplicationAccepted(FriendApplicationInfo application): Reports that the request status transitioned to approved. Update the matching application item usingapplication.getFromUserID().onFriendAdded(FriendInfo friend): Reports that the new friend was added to the contacts roster. Insert the friend into your local cache usingfriend.getUserID().
For complete listener registration details, see Get the friend list.
Was this page helpful?