注册

android集成easeUI3.0,收到通知后消息数量错误。

android集成easeUI3.0,收到通知后消息数量错误。
第一次收到通知后信息数量正确,我点击进入聊天界面再退出来。
这时候再次收到消息,通知上的消息的数目在原来的基础上累加,而不是重新计数。。。
已邀请:
com.hyphenate.easeui.ui.EaseBaseActivity
 

onResume
这个方法看下了
 
进入聊天界面之后调用未读消息数清零,http://docs.easemob.com/im/200androidclientintegration/50singlechat#未读消息数清零
可以参考以上的文档,您的问题主要是因为您没有在进入聊天界面调用未读消息数量清零,导致未读消息跟之前的数量累加了
参考easeui的EaseChatFragment类
 protected void onConversationInit(){
conversation = EMClient.getInstance().chatManager().getConversation(toChatUsername, EaseCommonUtils.getConversationType(chatType), true);
conversation.markAllMessagesAsRead();
// the number of messages loaded into conversation is getChatOptions().getNumberOfMessagesLoaded
// you can change this number
final List<EMMessage> msgs = conversation.getAllMessages();
int msgCount = msgs != null ? msgs.size() : 0;
if (msgCount < conversation.getAllMsgCount() && msgCount < pagesize) {
String msgId = null;
if (msgs != null && msgs.size() > 0) {
msgId = msgs.get(0).getMsgId();
}
conversation.loadMoreMsgFromDB(msgId, pagesize - msgCount);
}

}

要回复问题请先登录注册