I am a beginner for chat. I started to study the chat application I'm trying to connect an Android virtual device to an openfire xmpp server, but I can’t connect, I get java.net.UnknownHostException can anyone help me connect my top xmpp server on an Android device?
The code I use is:
ConnectionConfiguration config = new ConnectionConfiguration("pc" ,5222);
/*ConnectionConfiguration config =
new ConnectionConfiguration("192.168.0.1",5222,"pc");*/
/*config.setCompressionEnabled(true);
config.setSASLAuthenticationEnabled(true); */
config.setSecurityMode(SecurityMode.disabled);
config.setDebuggerEnabled(true);
config.setSASLAuthenticationEnabled(false);
XMPPConnection connection = new XMPPConnection(config);
Log.i("", "before connecting");
connection.connect();
Log.i("", "after connecting");
//connection.login("test", "test");
if(connection.isConnected()){
System.out.println("connection built");
connection.disconnect();
}
in manifest:
<uses-permission android:name="android.permission.INTERNET"/>
and Logcat I have java.net.UnknownHostException.
source
share