Reputation: 60
I have openfire installed on remote server. I can connect to it using the Spark XMPP client. But I am getting connection error when I use my Android XMPP client. Here is the connection code part of the Android client application:
// Create a connection
String serverIp = "14.63.XXX.XXX";
ConnectionConfiguration connConfig =
new ConnectionConfiguration(serverIp, 5222);
connConfig.setSASLAuthenticationEnabled(true);
XMPPConnection connection = new XMPPConnection(connConfig);
try {
connection.connect();
Log.i("XMPPClient", "Connected to " + connection.getHost());
} catch (XMPPException ex) {
Log.e("XMPPClient", "Failed to connect to " + connection.getHost());
Log.e("XMPPClient", ex.toString());
xmppClient.setConnection(null);
}
try {
connection.login(username, password);
.......
I am getting error when connection.connect(); is executed. I checked the port at the server and its open. I also tried 5223 port. I checked the permission on XMPP client also. I googled it and couldn't find a solution that fix this problem. Can anybody please suggest me what to do?
Upvotes: 1
Views: 4183
Reputation: 60
Found temporary solution :).. I put the connection part of the code in AsyncTask (http://developer.android.com/reference/android/os/AsyncTask.html). Now it works fine but I did other stuffs also, I used the smack API library from another project on the web that is already working.. So Im still searching for smack api that works with my project. I have seen http://asmack.org.. but didn't work for me!!
Upvotes: 2