Mark as read not working

Hi CometChat Team!

I am using markAsRead method for marking the messages as read and it is working okay. However, if the app launches by push notification:

  • Init the CometChat
  • Login the user
  • Fetch the messages from the sender (using the payload of push notification)
  • Get the message id of the last message and use it to mark as read

I was able to fetch the messages successfully, however, even I called the markAsRead method, the message doesn’t mark as read. I tried to delay (for 5 seconds) the calling of markAsRead method after loading the messages and it works fine.

That said, is there anything I can check to fix this? It looks calling the markAsRead right after initializing the CometChat SDK has something to do with this?

Any idea? @jeet.kapadia

Hi @srbalan,

You need to mark messages once you get the connected block called of Connection Delegate. For more info you can go through our documentation on Connection Status Delegates

Let us know if you face any other issue. We would be happy to assist you.

Regards
Jeet Kapadia

3 Likes

It works! :blush: Thanks so much @jeet.kapadia

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