# SendBird Reconnection Problem

**URL:** <https://community.sendbird.com/t/sendbird-reconnection-problem/1156>\
**Category:** Android\
**Tags:** syncmanager, chatsdk\
**Created:** [October 20, 2020, 4:36am UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156 "2020-10-20T04:36:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wildhansatriady](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/wildhansatriady/32/603_2.png) [@wildhansatriady](https://community.sendbird.com/u/wildhansatriady)\
**Post date:** [October 20, 2020, 4:36am UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/1 "2020-10-20T04:36:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Cjeon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/cjeon/32/222_2.png) [@Cjeon](https://community.sendbird.com/u/Cjeon)\
**Post date:** [October 20, 2020, 5:07am UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/2 "2020-10-20T05:07:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wildhansatriady](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/wildhansatriady/32/603_2.png) [@wildhansatriady](https://community.sendbird.com/u/wildhansatriady)\
**Post date:** [October 20, 2020, 7:11am UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/3 "2020-10-20T07:11:51Z")

</div>

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’

---

<div class="post-metadata">

**Author:** ![Cjeon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/cjeon/32/222_2.png) [@Cjeon](https://community.sendbird.com/u/Cjeon)\
**Post date:** [October 21, 2020, 1:18am UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/4 "2020-10-21T01:18:27Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Cjeon](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/cjeon/32/222_2.png) [@Cjeon](https://community.sendbird.com/u/Cjeon)\
**Post date:** [October 21, 2020, 6:41am UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/5 "2020-10-21T06:41:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![thi\_ledinh](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/thi_ledinh/32/1187_2.png) [@thi\_ledinh](https://community.sendbird.com/u/thi_ledinh)\
**Post date:** [May 16, 2021, 6:10pm UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/6 "2021-05-16T18:10:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Doo\_Rim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/doo_rim/32/239_2.png) [@Doo\_Rim](https://community.sendbird.com/u/Doo_Rim)\
**Post date:** [May 16, 2021, 11:49pm UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/7 "2021-05-16T23:49:32Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Sergey\_Baghdasaryan](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/sergey_baghdasaryan/32/1266_2.png) [@Sergey\_Baghdasaryan](https://community.sendbird.com/u/Sergey_Baghdasaryan)\
**Post date:** [May 25, 2021, 12:35pm UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/8 "2021-05-25T12:35:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Doo\_Rim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/doo_rim/32/239_2.png) [@Doo\_Rim](https://community.sendbird.com/u/Doo_Rim)\
**Post date:** [May 27, 2021, 1:44am UTC](https://community.sendbird.com/t/sendbird-reconnection-problem/1156/9 "2021-05-27T01:44:03Z")

</div>

> [@Sergey\_Baghdasaryan](#):
>
> unregisterPushhandler

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