SDKsAndroid
更新好友资料
使用 updateFriendsReq() 更新好友备注、置顶状态或扩展字段。
UpdateFriendsReq request = new UpdateFriendsReq();
request.setFriendUserIDs(new String[] { friendUserID });
request.setRemark(remark.trim());
OpenIMClient.getInstance().friendshipManager.updateFriendsReq(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
markFriendUpdateSubmitted();
}
@Override
public void onError(int code, String error) {
recordFriendUpdateFailure(code, error);
}
},
request
);UpdateFriendsReq 可设置 friendUserIDs、remark、isPinned 和 ex。一次调用会把同一字段值应用到全部目标好友;不同好友需要不同值时应分别调用。ex 是完整字符串。
| 字段 | 说明 |
|---|---|
friendUserIDs | 待更新的好友 ID 数组。 |
remark | 当前账号设置的好友备注。 |
isPinned | 是否置顶好友。 |
ex | 好友关系扩展字符串,按完整值覆盖。 |
成功 callback 表示更新请求完成。好友资料增量通过 onFriendInfoChanged 合并,事件处理见分页获取好友列表。
这个页面有帮助吗?