SendBird Reconnection Problem

Hi, I’ve got some issues with the SendBird Reconnection function.

  1. On Android API 29 the connection is always interrupted when we are trying to open chat room via notification. But when we deactivate background detection it is working normally.
  2. When we using auto background detection, how Send Bird determine when to disconnect or reconnect?

Hi @wildhansatriady, thank you for reporting the problem to us.

For problem #1, could you please further explain what you mean by interrupted? Does reconnection fail? Or existing connection gets closed?

For problem #2, what we do is that we register an ActivityLifecycleCallbacks using Application#registerActivityLifecycleCallbacks. Then we manage connection resources using onActivityResumed and onActivityPaused events.

If you could provide us the sdk version you are using and the error logs, we can look into it and possibly provide you some better answer. Thanks.

  1. here is the log

W/SendBird: [14:01:47.474 SocketManager:onError():716] >> onError : Socket is closed, reconnecting : false, explicitDisconnect : true

E/PINGER: [14:01:45.764 Connection$Pinger:stop():376] Pinger stop timer is null

yes, the existing connection gets closed.

  1. In API 29 there is a possibility that onActivityPause is called even our activity is in the foreground. I’m not sure whether this is a bug from android or not but, maybe you have some workaround for this?

we are currently using using this sdk version :

sendBird = ‘3.0.148’
sendBirdSyncManager = ‘1.1.26’

@wildhansatriady We’ll look into it. If you could please provide us some more logs (ideally the full log) it would be really helpful because knowing what happened before and after the socket closure will enable us to understand what was going on.

For the workaround, we will have to pinpoint the problem first so when we’ve found the root cause we’ll try to come up with possible solutions. Thank you.

Hi @wildhansatriady, I looked into it but at the current moment I was unable to locate the source of the problem. Unfortunately my hands are currently full so I cannot promise you when I can deliver some meaningful results. Could you please contact our solutions team or sales team so that we can issue a ticket for this? Then hopefully some of my low-priorities jobs can be delayed for this. Please let them know you have posted your question here and we’ve talked about this - this will speed up some process.

I’m sorry that I cannot be helpful to you now but we’ll do our best.

Hi cjeon, today i’m trying reconnect to sendbird but always retun connectionfail. could you give me the reference to check?

Hi, @thi_ledinh

I can help you. What is your problem?! Could you explain your issue in detail?!
If you attach your code snippets and logs, it will be helpful to resolve your issues!

Hi, I have same issue when trying to discconect and unregisterPushhandler on my Android app i get this logs
2021-05-25 16:35:22.300 7876-7876/com.burlymarmot.peaceofmind.caregiver_v2 E/PINGER: [16:35:22.299 Connection$Pinger:stop():428] Pinger stop false
2021-05-25 16:35:22.303 7876-7876/com.burlymarmot.peaceofmind.caregiver_v2 E/Sendbird:PINGER: [16:35:22.301 Connection$Pinger:stop():429] Pinger stop false
2021-05-25 16:35:22.311 7876-8977/com.burlymarmot.peaceofmind.caregiver_v2 W/SendBird: [16:35:22.311 Connection$1:onFailure():179] onFailed instance : com.sendbird.android.Connection@a6a77a5
2021-05-25 16:35:22.312 7876-8977/com.burlymarmot.peaceofmind.caregiver_v2 W/Sendbird: [16:35:22.312 Connection$1:onFailure():180] onFailed instance : com.sendbird.android.Connection@a6a77a5
2021-05-25 16:35:22.314 7876-8977/com.burlymarmot.peaceofmind.caregiver_v2 W/SendBird: [16:35:22.313 Connection$1:onFailure():185] onFailed handler : com.sendbird.android.SocketManager@c127a12
2021-05-25 16:35:22.316 7876-8977/com.burlymarmot.peaceofmind.caregiver_v2 W/Sendbird: [16:35:22.315 Connection$1:onFailure():186] onFailed handler : com.sendbird.android.SocketManager@c127a12
2021-05-25 16:35:22.317 7876-8977/com.burlymarmot.peaceofmind.caregiver_v2 W/SendBird: [16:35:22.317 SocketManager:onError():734] >> onError : Socket is closed, reconnecting : false, explicitDisconnect : true

@Sergey_Baghdasaryan
To use unregisterPushHandler, Connection must be made!
Please try unregisterPushHandler and disconnect.