Quantcast
Channel: Ignite Realtime: Message List
Viewing all articles
Browse latest Browse all 12000

Andriod, Smack and Openfire. HELP PLS!

$
0
0

Hi! I've been reading the documentation of Smack libery so that I can do a simple connection to the Openfire server and i havent been able to make it. I've install Openfire and configure it by default then created a new user and test it with the Spark client and it worked. Then a tried making my own code using Eclipse with the Android IDE following the steps of the documentation and failed. Can someone help me showing me a basic code of how to do it? this is my code so far:

 

in AndriodManifest.xml

 

<uses-permission android:name="android.permission.INTERNET" />

 

.....

in MainActivity.java

 

public static final String HOST = "10.0.0.4";

public static final int PORT = 5222;

public static final String SERVICE = "@localhost"; //not sure what goes here...

 

 

public void conect(View v){  //this is a onClick event

   

              ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, SERVICE);

        XMPPConnection connection = new XMPPConnection(connConfig);

          try {

            connection.connect();

          } catch (XMPPException ex) {

              connection = null;

          }

           try {

                     connection.login("test","test");

           }catch (XMPPException ex) {

                 connection = null;

               }    

    }

 

Maybe I'm missing something since I'm new to Andriod and Smack.


Viewing all articles
Browse latest Browse all 12000

Trending Articles