I am using smack to build a chat app for android.
I am not able to resume the previous stream as a result i am facing a potential message loss. Here is what i am able to understand throgh my debugging.
- I am able to connect and login to the server(ejabberd) .
- I have manually set the resource in the configuration. But it different for different phones.
- I am using stream management and it succsessfully using stream.
- When disconnect and reconnect, a new connection is established. But on the server i am getting the error
Stream closed by local host: Replaced by new connection (conflict)
i know this error tells us that a different client is logged in with same resource. But i have never changed the device. I have kept the resource at the same everytime i connect the server.
So i think what actually happens when we disconnecrt and reconnect, the server sees us a different client but with the same resource name. As if i do not reset the resource manually, resource name changes everytime i connect. and hence i am unable to resume the session .
What is i am missing so that i can bind my resource to the device and everytime i refresh the server sees me as single client with the same resource name.
Please suggest some technique as this has got me so crazy i have begin to pull my hair.