mSmackAndroid = SmackAndroid.init(context);
mConnectionChangeListeners = new ArrayList();
mXmppRoster = XmppRoster.getInstance(context);
mXmppRoster.registerListener(this);
mXmppChatManager = XmppChatManager.getInstance(context, this);
mXmppMUCManager = XmppMUCManager.getInstance(context, this);
mXmppFileTransferManager = XmppFileTransferManager.getInstance(context, this);
mXmppChatManager.registerListener(this);
mXmppMUCManager.registerListener(this);
mXmppFileTransferManager.registerListener(this);
mMessageStorage = new MessageStorage();
IntentFilter intentFilter = new IntentFilter(Constants.ACTION_STORAGE_NEW_MESSAGE);
mContext.registerReceiver(mStorageUpdateReceiver, intentFilter);
ConnectionConfiguration config = new ConnectionConfiguration(XMPP_HOST, 5222);
SASLAuthentication.supportSASLMechanism(“PLAIN”, 0);
config.setSendPresence(false);
config.setReconnectionAllowed(false);
config.setDebuggerEnabled(true);
config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
mConnection = new XMPPTCPConnection(config);
mConnection.getRoster();
try {
mConnection.connect();
mPingManager = PingManager.getInstanceFor(mConnection);
mPingManager.registerPingFailedListener(pingFailedListener);
if (mConnection.isConnected()) {
mConnection.login(mLogin, mPassword);
onConnectionEstablished();
}
} catch (Exception e) {
Log.w(ID, “XMPP connection failed”, e);
if (e instanceof XMPPException) {
Log.w(ID, "XMPP connection failed because of stream error: " + e.getMessage());
}
}
Is there necessary a special sequence of comands when disconnecting, or to wait until aSmack get disconnected or anything ?
Reconnection is not allowed as I am handlig this manually