I made this as simple as I can in code. I am using asmack library for android in version 8-0.8.3.
My code:
package info.zajacmp3.servercommunication;
import org.jivesoftware.smack.Connection;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
public class XmppService extends Service{
public void xmppService() throws XMPPException {
Connection conn1 = new XMPPConnection("jabber.org");
conn1.connect();
}
@Override
public void onCreate(){
//TODO:actions to perform when service is created
try {
xmppService();
} catch (XMPPException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public IBinder onBind(Intent intent) {
// TODO Replace with service binding
return null;
}
}
It freeze my app and cause me and error: no dns resolver active. There is nothing on the web about it.
I do really hope to get some help or clues.
Also tried like this:
private final static String server_host = "jabber.org"; private final static int SERVER_PORT = 5222;
public void xmppService() throws XMPPException {
ConnectionConfiguration config = new ConnectionConfiguration( server_host, SERVER_PORT);
XMPPConnection m_connection = new XMPPConnection(config);
try {
SASLAuthentication.supportSASLMechanism("PLAIN");
config.setSASLAuthenticationEnabled(true);
m_connection.connect();
Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);
} catch (XMPPException e) {
e.printStackTrace();
}
}
@UPDATE:
Using smack library instead of asmack gets me the same problem. I get no error log, but after disconnecting debugger I get: