AVIMClient client = AVImClientManager.getInstance().getClient();
HashMap<String, Object> attributes = new HashMap<>();
attributes.put(ChatAttributes.isNameless, ChatAttributes.IS_NAMELESS_TYPE_NO);
attributes.put(ChatAttributes.creator, KMHelper.config().userId);
attributes.put(ChatAttributes.type, ChatAttributes.IS_GROUP_NO); // 私聊
Map<String, Map<String, String>> members = new HashMap<>();
// 对聊用户
Map<String, String> to = new HashMap<>();
to.put(ChatAttributes.real_name, mFriend.real_name);
to.put(ChatAttributes.user_portrail, mFriend.user_portrail);
to.put(ChatAttributes.remark, mFriend.remark);
members.put(String.valueOf(mFriend.user_id), to);
// 当前用户
Map<String, String> from = new HashMap<>();
from.put(ChatAttributes.real_name, userName);
from.put(ChatAttributes.user_portrail, userAvatar);
members.put(KMHelper.config().userId, from);
attributes.put(ChatAttributes.memberInfos, members);
final String conversationName = StringUtils.isBlank(mFriend.real_name) ? mFriend.remark : mFriend.real_name;
client.createConversation(Arrays.asList(memberId), "", attributes, false, true, new AVIMConversationCreatedCallback() {
@Override public void done(AVIMConversation avimConversation, AVIMException e) {
if (avimConversation == null) {
return;
}
在没有执行 client.createConversation方法时,创建者ID和对方ID都是存在的;执行该方法后,返回的avimConversation对象中,members里的创建者ID默认为1了...
-
创建时间
16年3月22日
-
最后回复
16年3月22日
-
1
回复
-
728
浏览
-
2
用户