I have a button in Android Application. When the button is clicked following code is invoked:
TestSmack a = new TestSmack();
a.login("[email protected]","password");
I have a TestSmack class.....in the constructor of this class i wrote
public TestSmack ()
{
ConnectionConfiguration connConfig = new
ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
connection = new XMPPConnection(connConfig);
}
where XMPPConnection connection is a global variable. And in the login method I try to connect to the Server:
public void login(String userName, String password) throws XMPPException
{
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
connection.connect();
connection.login(userName, password);
}
But it crashes. I don't know whats happening.
Whereas when I call these all methods from main()
and run a simple Java application in separate project (Java, not Android) it works fine.
I am not able to figure out whats the problem.
Thanks