RongIM.getInstance().setMessageAttachedUserInfo(true);
RongIM.getInstance().setCurrentUserInfo(new UserInfo(...));
public void setRCProvider() {
RongIM.setUserInfoProvider(new RongIM.UserInfoProvider() {
@Override
public UserInfo getUserInfo(String userId) {
return getOtherInfo(userId);
}
}, true);
}
private UserInfo getOtherInfo(final String userId) {
HttpClient.getOtherInfo(userId, new ProgressSubscriber<InvitePersonResultBean.DataBean>(getApp()) {
@Override
public void onNext(InvitePersonResultBean.DataBean dataBean) {
String imgHeadUrl = FrescoUtil.getImageUrl(dataBean.getHead_img());
UserInfo rongUserInfo = new UserInfo(userId, dataBean.getUsername(), Uri.parse(imgHeadUrl));
//因为是异步任务,所以在获取到用户信息之后需要刷讯融云缓存
RongIM.getInstance().refreshUserInfoCache(rongUserInfo);
}
});
return null;
}
注意:如果设置之后还是不显示,检测一下你设置的UserInfo 中的三个参数值是否是一一对应的!!
网友评论