Get unread message count from group channel

For the messages send from push notification the groupchannel getUnreadCount still giving value as 0. whereas if not send from push notification groupchannel getUnreadCount is giving the count properly.
Please let me know does it reqiures any specific setting from dashboad or any thing else from code perspective.

Hi @Prerna_Kumari,

Welcome to the Sendbird Community! I’d love to help you dig into this issue. Could you tell me how you’re grabbing the getUnreadCount on the push notification? Additionally, could you provide me with the SDK and SDK version you’re using?

Hi,
Thanks for your response. From push Notification remote json message contain “channel_unread_message_count” inside channel object which is giving me the correct count whereas if i try to get directly from Groupchannel.getUnreadMessageCount() its not count the unread message that comes from Notification.

for example:
if I send one notification outside app, from remote json i will get “channel_unread_message_count”:1 whereas if i try to fetch the same from Groupchannel.getUnreadMessageCount() returns 0;

SDK version:
implementation ‘com.sendbird.sdk:sendbird-android-sdk:3.0.159’
implementation ‘com.sendbird.sdk:sendbird-syncmanager:1.1.30’
implementation ‘com.sendbird.sdk:sendbird-calls:1.5.3’

Hi @Prerna_Kumari,

My apologies for the delayed response. Let me take a look at this and see if I can reproduce the behavior.

Hi @Tyler

Any update on the issue.

Hi @Tyler and @Prerna_Kumari
Any update for this issue.
I have same problem.

Step reproduce:
1/ App running in background mode
2/ Received push notification in the background mode
3/ Fetch the list channel in background and update on list channel ui.
4/ Resume app to foreground mode.
5/ => Unread message does not update, still return old value. I used this func this.groupChannel.unreadMessageCount;

Device: iOS / android
Platform: React native
Language: typescript
Sendbird package: “sendbird”: “3.1.9”

@Tyler I am also facing this issue. Push notifications are sent in real-time and unread_message_count is correct in its payload. But when getting unreadMessageCount from the GroupChannel object using SDK, it is unreliable. It rarely returns correct value. Most of the times, old value is returned. Also, the ChannelHandler.onChannelUpdated() is also not invoked when new message is received. It should be invoked because unreadMessageCount will be updated.

SDK : Android
Versions used :
com.sendbird.sdk:sendbird-chat:4.9.0
com.sendbird.sdk:uikit:3.5.7

1 Like