SDKsAndroid
Check friendship
Use checkFriend() to check whether specified users are friends of the current user.
OpenIMClient.getInstance().friendshipManager.checkFriend(
new OnBase<List<FriendshipInfo>>() {
@Override
public void onSuccess(List<FriendshipInfo> relations) {
showFriendshipStates(relations);
}
@Override
public void onError(int code, String error) {
recordFriendshipCheckFailure(code, error);
}
},
Arrays.asList("user_a", "user_b")
);The callback returns List<FriendshipInfo>. Each item's userID identifies the target user. result == 1 means the user is a friend and is not in the blacklist. Interpret other result values only through the server contract; do not create additional client-side states.
This method only establishes a relationship snapshot and does not trigger friendship callbacks. Use getFriendsInfo() when nickname, avatar, or friend remark data is required.
Was this page helpful?