I am using asmack-android-8-source-4.0.6
when i try to connect to the server whether it is openFire or Ejabbered i get this exception
org.jivesoftware.smack.SmackException$NoResponseException
here's my code:
SmackAndroid.init(getApplicationContext());
ConnectionConfiguration conConfig = new ConnectionConfiguration(HOST, PORT);
conConfig.setDebuggerEnabled(true);
connection = new XMPPTCPConnection(conConfig);
try {
connection.connect();
Log.i("AppName", "CONNECTED TO " + connection.getHost());
}
when i call
connection.connect();
i get this exception :
org.jivesoftware.smack.SmackException$NoResponseException
note the i have tried the same code on asmack-android-19-0.8.10 and it works perfectly
i guess the issue is with the
XMPPTCPConnection
because in the asmack-android-19-0.8.10 i use
XMPPConnection
any help ?
I have found the problem all i did is adding this line:
ConnectionConfiguration.setSecurityMode(SecurityMode.disabled);
and i was connected to server successfully
here's my configuration in the end :
ConnectionConfiguration ConnectionConfiguration = new ConnectionConfiguration(HOST, PORT);
ConnectionConfiguration.setDebuggerEnabled(true);
ConnectionConfiguration.setSecurityMode(SecurityMode.disabled);
try this:
public void connect()
{
Thread t = new Thread(new Runnable() {
@Override
public void run() {
SmackAndroid.init(getApplicationContext());
ConnectionConfiguration conConfig = new ConnectionConfiguration(HOST, PORT);
conConfig.setDebuggerEnabled(true);
conConfig.setSecurityMode(SecurityMode.disabled);
connection = new XMPPTCPConnection(conConfig);
try {
connection.connect();
connection.login("unm", "pswd");
Presence presence = new Presence(Presence.Type.available);
connection.sendPacket(presence);
setConnection(connection);
} catch (XMPPException e) {
e.printStackTrace();
} catch (SmackException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
});
t.start();
}