[Problem/Question]
My app doesn’t receive the events like Typing, onNewMessage and others even though the app is foreground and inside the chat screen screen. All listeners are setup and active. Many times happen this.
SDK Version: com.sendbird.sdk:sendbird-chat:4.19.1
I notificted the following statement in console:
Discard the command[ReadEventCommand] because app is in background
Logs:
2025-04-23 18:58:09.064 29527-29828 SendbirdChat com.app.hm D [18:58:09.063 CommandRouter:onMessage():78] Recv: SYEV{"channel_id":852987990,"cat":10900,"data":{"user_id":"8002","nickname":"Ryan Howard","profile_url":"","require_auth_for_profile_image":false,"metadata":{}},"sts":1745414889371,"ts":1745414889371,"channel_url":"sendbird_group_channel_408707474_ed94bbf7fd107ecb66a5a6a62b48d03d5d555ac2","channel_type":"group","is_super":false,"is_access_code_required":false,"has_bot":false,"has_ai_bot":false}
2025-04-23 18:58:09.065 29527-29828 SendbirdChat com.app.hm D [18:58:09.065 CommandRouter:onMessage():89] command: [SYEV]: ackHandled=false, false
2025-04-23 18:58:09.066 29527-29828 SendbirdChat com.app.hm D [18:58:09.065 CommandRouter:onMessage():96] Discard the command[ChannelEventCommand] because app is in background
2025-04-23 18:58:10.806 29527-29828 SendbirdChat com.app.hm D [18:58:10.806 CommandRouter:onMessage():78] Recv: SYEV{"channel_id":852987990,"cat":10901,"data":{"user_id":"8002","nickname":"Ryan Howard","profile_url":"","require_auth_for_profile_image":false,"metadata":{}},"sts":1745414891122,"ts":1745414891122,"channel_url":"sendbird_group_channel_408707474_ed94bbf7fd107ecb66a5a6a62b48d03d5d555ac2","channel_type":"group","is_super":false,"is_access_code_required":false,"has_bot":false,"has_ai_bot":false}
2025-04-23 18:58:10.808 29527-29828 SendbirdChat com.app.hm D [18:58:10.808 CommandRouter:onMessage():89] command: [SYEV]: ackHandled=false, false
2025-04-23 18:58:10.809 29527-29828 SendbirdChat com.app.hm D [18:58:10.808 CommandRouter:onMessage():96] Discard the command[ChannelEventCommand] because app is in background
2025-04-23 18:58:18.384 29527-29828 SendbirdChat com.app.hm D [18:58:18.384 CommandRouter:onMessage():78] Recv: SYEV{"channel_id":852987990,"cat":10901,"data":{"user_id":"8002","nickname":"Ryan Howard","profile_url":"","require_auth_for_profile_image":false,"metadata":{}},"sts":1745414898612,"ts":1745414898612,"channel_url":"sendbird_group_channel_408707474_ed94bbf7fd107ecb66a5a6a62b48d03d5d555ac2","channel_type":"group","is_super":false,"is_access_code_required":false,"has_bot":false,"has_ai_bot":false}
2025-04-23 18:58:18.386 29527-29828 SendbirdChat com.app.hm D [18:58:18.386 CommandRouter:onMessage():89] command: [SYEV]: ackHandled=false, false
2025-04-23 18:58:18.387 29527-29828 SendbirdChat com.app.hm D [18:58:18.387 CommandRouter:onMessage():96] Discard the command[ChannelEventCommand] because app is in background
2025-04-23 18:58:18.491 29527-29828 SendbirdChat com.app.hm D [18:58:18.490 CommandRouter:onMessage():78] Recv: MESG{"channel_id":852987990,"scrap_id":"","user":{"name":"Ryan Howard","image":"","require_auth_for_profile_image":false,"guest_id":"8002","id":408707474,"role":"operator","metadata":{},"is_bot":false,"is_ai_bot":false,"is_active":true,"is_blocked_by_me":false,"friend_name":null,"friend_discovery_key":null},"silent":false,"check_reactions":false,"is_op_msg":true,"is_guest_msg":true,"data":"","sts":1745414898600,"channel_url":"sendbird_group_channel_408707474_ed94bbf7fd107ecb66a5a6a62b48d03d5d555ac2","channel_type":"group","is_super":false,"mention_type":"users","mentioned_users":[],"message_events":{"send_push_notification":"receivers","update_unread_count":true,"update_mention_count":true,"update_last_message":true},"message_retention_hour":-1,"request_id":"1745409550869","translations":{"en":"86"},"custom_type":"text","is_removed":false,"last_updated_at":1745414898600,"message":"86","msg_id":4416802681,"ts":1745414898600,"unread_cnt":{"all":1,"ts":1745414898795}}
2025-04-23 18:58:18.492 29527-29828 SendbirdChat com.app.hm D [18:58:18.492 CommandRouter:onMessage():89] command: [MESG]: ackHandled=false, false
2025-04-23 18:58:18.492 29527-29828 SendbirdChat com.app.hm D [18:58:18.492 CommandRouter:onMessage():96] Discard the command[ReceivedUserMessageCommand] because app is in background
2025-04-23 18:58:18.895 29527-29828 SendbirdChat com.app.hm D [18:58:18.894 CommandRouter:onMessage():78] Recv: READ{"channel_id":852987990,"user":{"name":"Ryan Howard","image":"","require_auth_for_profile_image":false,"guest_id":"8002","id":408707474,"role":"","metadata":{},"is_bot":false,"is_ai_bot":false,"is_active":true,"is_blocked_by_me":false},"ts":1745414898600,"sts":1745414898600,"channel_url":"sendbird_group_channel_408707474_ed94bbf7fd107ecb66a5a6a62b48d03d5d555ac2","channel_type":"group","is_super":false,"target_parent_message_id":null}
2025-04-23 18:58:18.897 29527-29828 SendbirdChat com.app.hm D [18:58:18.896 CommandRouter:onMessage():89] command: [READ]: ackHandled=false, false
2025-04-23 18:58:18.897 29527-29828 SendbirdChat com.app.hm D [18:58:18.897 CommandRouter:onMessage():96] Discard the command[ReadEventCommand] because app is in background
2025-04-23 18:58:48.489 29527-29808 SendbirdChat com.app.hm D [18:58:48.487 TimeoutScheduler:cancelAll():94] __ TimeoutScheduler::cancelAll(true)
2025-04-23 18:58:48.491 29527-29828 SendbirdChat com.app.hm D [18:58:48.491 CommandFactoryImpl:parseWebSocketEventCommand():46] Discard a command: PONG
To reproduce this issue, You just launch the app and send the message from other user and you will not receive any new message until you refresh or jump to his chat window.