Channels are not updated right after app moves app to foreground

[Problem/Question]
I’m facing the following problem. Channel Groups information is not updated immediately.

[SDK Version]
Android SDK Version - “4.15.4”

[Reproduction Steps]
I have active list of chats (group channels). I constantly receive real-time updates for any actions made in every chat using GroupChannelHandler using this callback → onChannelChanged. When I move app to the background and meantime my group channels are updated (active catting happens there) when I move app to foreground I expect to get latest group channel details (like unread message count). For that I’m re-initialising ChannelHandler and force to load group channels available for my user by calling channelCollection.loadMore(). And the problem here that I don’t receive updated information for my channels. And only when I move app to background and to foreground again I got update information.

[Current impact]
User has to reopen the app or wait for new event to happen in channel to see latest information about chat.

Hi there. @Alex_Iachimov

Please consider using channelCollection Handlers rather than channel event handlers. The latest version 4.15.7 now includes similar data in the channelCollection handlers vs the channel event handlers.

If you have a channel collection handler available, it will fire on channelUpdated automatically when moving from the background to foreground.

Hi @Jason , Thanks for reply.
Could you please clarify you your proposal?
I’m using MessageCollectionHandler to listen for Chat events like “Message Added”, “Message Deleted”, “Message Updated” , e.t.c. And indeed I can see a new callbacks like onChannelUpdated and onChannelDeleted and right now I don’t have any specific logic for these events.

I initialize MessageCollectionHandler when user opens a Chat Screen and wants to start messaging.

But when user is on Screen with the list of all available Chats I’m using GroupChannelHandler with the specific channel callback like onChannelChanged, onChannelHidden, onChannelDeleted, e.t.c.

The problem is that these callback are not triggered when app is in background. That’s why when app is restored from background I reinit GroupChannelCollection and try to get latest information about channels by calling groupChannelCollection.loadNext() and I expect to get an updated information about the channels but I don’t get it. I suppose that’s why GroupChannelCollection is designed for.

Do you suggest to init MessageCollectionHandler for all the chats once user open Chat List screen and listen for onChannelUpdated events? I also can see that onChannelUpdated is triggered almost for all events (user started typing, send a message, e.tc) In my case I just want to have latest info about the channels.

Hey @Jason, I think I got what you meant, looks like using GroupChannelCollectionHandler solves the problem now I can see updated data when app is restored from background. Thanks you for your help.