XMPPTCPConnection connection =
new XMPPTCPConnection("myemail@gmail.com", "mypassword", "mtalk.google.com");
try {
connection.connect();
} catch (XMPPException e) {
e.printStackTrace();
} catch (SmackException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
connection.addConnectionListener(new ConnectionListener() {
@Override
public void connected(XMPPConnection connection) {
Log.d("ARUN SHANKAR SMACK ", "connected");
}
@Override
public void authenticated(XMPPConnection connection, boolean resumed) {
Log.d("ARUN SHANKAR SMACK ", "authenticated");
}
@Override
public void connectionClosed() {
Log.d("ARUN SHANKAR SMACK ", "connection closed");
}
@Override
public void connectionClosedOnError(Exception e) {
Log.d("ARUN SHANKAR SMACK ", "connection closed on error");
}
@Override
public void reconnectionSuccessful() {
Log.d("ARUN SHANKAR SMACK ", "reconnected");
}
@Override
public void reconnectingIn(int seconds) {
Log.d("ARUN SHANKAR SMACK ", "reconnecting");
}
@Override
public void reconnectionFailed(Exception e) {
Log.d("ARUN SHANKAR SMACK ", "reconnecting failed");
}
});
I run this in an AsyncTask. So the question of NetworkOnMainThreadException is not there. But I get a connectionTimeOutException when i use mtalk.google.com and UnresolvedHostException when i use talk.google.com
Please help