
IM即时通讯
安全可靠、全球互通

实时音视频
流畅稳定、省钱省力
回答:
融云的会话列表是由fragment实现的。如果用户的activity没有通知fragment,fragment是不会进行自动刷新的。
下面是两个解决方案,以供参考。为了方便描述,下面所有的activity都是指的集成了会话列表ConversationListFragment的那个activity。
在第一个帐号调用logout之后,activity调用finish()关闭activity,这样第二个帐号登录的时候activity和ConversationListFragment都会重新走生命周期重新加载。
4.X的SDK,如果因为种种原因不方便在logout的时候finish掉activity,可以在重新登录的时候在activity里使用下面代码重新加载fragment。
Uri uri = Uri.parse("rong://" + getApplicationInfo().packageName).buildUpon() .appendPath("conversationlist") .appendQueryParameter(Conversation.ConversationType.PRIVATE.getName(), "false") //设置私聊会话是否聚合显示 .appendQueryParameter(Conversation.ConversationType.GROUP.getName(), "true")//群组 .appendQueryParameter(Conversation.ConversationType.DISCUSSION.getName(), "false")//讨论组 .appendQueryParameter(Conversation.ConversationType.PUBLIC_SERVICE.getName(), "false")//公共服务号 .appendQueryParameter(Conversation.ConversationType.APP_PUBLIC_SERVICE.getName(), "false")//公共服务号 .appendQueryParameter(Conversation.ConversationType.SYSTEM.getName(), "false")//系统 .build(); mConversationListFragment.setUri(uri); mConversationListFragment.onRestoreUI();
3. 5.X的SDK可以在切换账户后调用
if (mConversationListViewModel.getConversationListLiveData().getValue() != null){
mConversationListViewModel.getConversationListLiveData().getValue().clear();
}
mConversationListViewModel.getConversationList(false, true);
其中mConversationListFragment即用户集成的会话列表,uri设置请参考Android开发文档。
其中mConversationListViewModel是,继承ConversationListFragment的自定义的Fragment里可以直接调用