I am developing a Chat application in which
- I have a background service that is continuously running in the background.
- The Application is running smoothly and I am able to Receive and Send message without any issue.
- 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
- What is the use of PingManager? Can PingManager be helpful in this case?
- 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:
- 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.
- Use Alarm Services. (PROBLEM : Messages that were in Que because of the connection lost will be dependent on next alarm schedule)
- 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)