Smack 4.1 Re-connection issue

I am developing a Chat application in which

  1. I have a background service that is continuously running in the background.

  2. The Application is running smoothly and I am able to Receive and Send message without any issue.

  3. I am using default Smack 4.1 Re-connection Manager, which is connecting as soon the connection get lost.(Almost 90% of the time)
    **But sometime, When the Connection is Lost, the Smack Re-connection Manager stops working,****I am not been able to find out, What is causing this issue?**If I check my phone, after the delay of 12 to 14 hour, I can see the Android service is running, but the XMPP re-connection stopped worked. so I had to force stop the application and had to restart it for connecting the XMPP server again.My assumption is that is happening when “Phone Network switches from Wifi-to-Data or Data-to-Wifi”, In this mean time, Smack 4.1 Re-connection Manager stops working. Although, I am not sure about it.If someone had idea, what I am doing wrong, Please helpAnd I have Questions

  4. What is the use of PingManager? Can PingManager be helpful in this case?

  5. What is StreamManagement? How can I enable it? Is it helpful in this case?
    Any other solutions to conquer this problem? I am thinking of the following solutions:

  6. To use GCM as well with XMPP, so when XMPP failed to reconnect, I can get the PUSH and connect again on the basis of the PUSH.

  7. Use Alarm Services. (PROBLEM : Messages that were in Que because of the connection lost will be dependent on next alarm schedule)

  8. Every time connect XMPP when user returns to the Application. (PROBLEM : Messages that were in Que because of the connection lost will be dependent on the User returning back to app)

1 Like

I have same issue, did you find any solution. And did u use ping manager or stream management? I’m avoiding pinging to server as it will cause battery loss and using stream management im getting messages twice sometime.