Stream:error (conflict)

I know this has been questioned many times but no one has really given a definite answer on how to catch it. Basically I want to inform the user that he tried login using the same resource and the should have log out first. But, in the try and catch, i cant catch this. Any light on this?

If you implement an org.jivesoftware.smack.ConnectionListener, it will initiate a callback to that class when your connection is closed and pass you the exception if the connection closed from an error.

public class XMPPConnectionListener implements ConnectionListener {     @Override
    public void connectionClosed() {
        // ...
    }     @Override
    public void connectionClosedOnError(Exception e) {
        // ...
    }
}

Remember to attach the listener to your XMPPConnection:

xmpp.addConnectionListener(new XMPPConnectionListener());

HTH

Dan

Many thanks Dan. Greatly appeciated.

Hi.

By adding a connectionlistener the stderr stream error disappeared but no error came in any of the listeners methods:

http://www.igniterealtime.org/community/message/197440#197440

Guess I just should be glad about this

However magic is strange and the error which came in the first place either:

  1. Happen to a lot of people

  2. I have done something stupid

Either way I would like to understand this.

Cheers and thanks for a great product

//Marcus