CometChat.markAsRead not clearing unread count

We are using CometChatMessageScreen of ui kit in our app - ResellMe. However, we are facing a weird bug. Unread counter on our app is not cleared even after calling markasread.

Hi @himanshu.jain2206,

Can you please elaborate more on the issue you are facing. Are you using CometChatConversationListScreen if not then which method you are using to get an unread count?

Yes using CometChatConversationListScreen.

Also, Can you point me specific function, which takes care of it. I’ll try to debug it at my end as well.

Hi @darshan.bhanushali
Any update?

Hi @himanshu.jain2206,

We checked at our end and it’s working fine. The unread message count of conversation is getting cleared.

There are two places where the unread count is being displayed.

  1. Is a unread count of Conversation object using conversation.getUnreadMessageCount() method. This method will return the unread message count of a particular conversation. You will find it in the ConversationListAdapter.java.

  2. Is a badge added at the conversation menu. This fetches total number of unread message count for a logged-In user. You will find it in CometChatUnified.java
    Please check the below link to know more

2 Likes

This is what we are using in our pto fetch unread counters and calling mark as read on the latest message received in a conversation. The problem is, markAsRead function which we are using in clearing the unread count is not clearing this badge.

Hi @himanshu.jain2206 ,

Can you please share the code where you have added markAsRead function, as you have modified the code at your end and we are not able to identify your issue clearly.

1 Like

@darshan.bhanushali,
we have not modified the code. The only thing we did was added UI Kit and added CometChatConversationListScreen Fragment and CometChatMessageScreen fragment in our app via fragment transaction. Whenever we are opening CometChatMessageScreen, it calls markAsRead function inside it, completes it successfully, but it is not reflected. Next time we open CometChatMessageScreen, it still markAsRead the same message. But counter still shows in cometchatconversationlistscreen.

Also, I have tried with sample android kotlin chat code with out auth keys. The problem is visible in it as well. Whenever I go into the Chat Message screen from conversation screen, it is not clearing the counter in sameple chat code provided by cometchat as well

Hello @himanshu.jain2206,
As discussed over the call, the real-time communication for your app was disabled as you the limit for the number of concurrent users was crossed. We have enabled it for now.
Please do let us know in case you face any issues.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.