Skip navigation
5287 Views 3 Replies Latest reply: Apr 9, 2013 7:35 AM by JohnBe RSS
Flow KeyContributor 601 posts since
Jan 11, 2007
Currently Being Moderated

Jun 7, 2013 2:29 AM

Current state of aSmack (Smack for Android)

aSmack was initiated by Rene Treffer for the buddycloud project. The last available download from him on the aSmack project page on googlecode is from December 2010. Prior to that, the development has been moved to github. But the development stalled there. The last commit is from Aug 2010. This is when I forked the aSmack and Smack repositories on github and started to merge the changes introduced by Smack 3.2.0. I has also added the changes from the upstream. aSmack codebase is now in sync with Smack upstream development.

 

  • Tarik Bronze 2 posts since
    Feb 16, 2013
    Currently Being Moderated
    Feb 16, 2013 10:52 PM (in response to Flow)
    Re: Current state of aSmack (Smack for Android)

    Hi Flow,

     

    I passed 1 week trying to understand this sentence in the README:

    "In order to work correctly on Android, you need to register Smack's

    XMPP Providers and Extensions manually and init some static code

    blocks before you doing any XMPP activty. Calling

    SmackAndroid.init(Context) (in org.jivesoftware.smack) will do this

    for you."

     

    But really it is difficult for me. Could you please help with a step by step TUTORIAL so that we could understand?

     

    What do you call context ? Are you refering to the Context of a main class activity ?

     

    The truth is that if you could give a simple working example I would be really greatful.

     

    Here is my code but I think I'm not getting it:

     

    ############################################

    public class MainActivity extends Activity {

              public final static String EXTRA_MESSAGE = "com.example.rasaxe.MESSAGE";

              private static Context context;

              @Override

              protected void onCreate(Bundle savedInstanceState) {

                        super.onCreate(savedInstanceState);

                        setContentView(R.layout.activity_main);

                        context = getApplicationContext();

              }

     

     

        /*public static Context getAppContext() {

            return context;

        }*/

     

              @Override

              public boolean onCreateOptionsMenu(Menu menu) {

                        // Inflate the menu; this adds items to the action bar if it is present.

                        getMenuInflater().inflate(R.menu.activity_main, menu);

                        return true;

              }

     

              /** Called when the user clicks the Send button */

              public void sendMessage(View view) {

                  // Do something in response to button

                        Intent intent = new Intent(this, DisplayMessageActivity.class);

                        EditText editText = (EditText) findViewById(R.id.edit_message);

                  String message = editText.getText().toString();

                  intent.putExtra(EXTRA_MESSAGE, message);

     

     

                        SmackAndroid.init(context);

                  /*AndroidConnectionConfiguration config = null;

                  try {

                                  config = new AndroidConnectionConfiguration("jabber.org", 5222);

                        } catch (XMPPException e) {

                                  // TODO Auto-generated catch block

                                  e.printStackTrace();

                        }

                  Connection.DEBUG_ENABLED = true;

                  Connection conn2 = new XMPPConnection(config);

                  try {

     

                                  conn2.connect();

                                  conn2.login("rasaxe", "Tahranovitch1");

                        } catch (XMPPException e) {

                                  // TODO Auto-generated catch block

                                  e.printStackTrace();

                        }*/

                  startActivity(intent);

              }

     

     

    }

    ################################

     

    Regards,

     

    Tarik

  • JohnBe Bronze 1 posts since
    Apr 9, 2013
    Currently Being Moderated
    Apr 9, 2013 7:35 AM (in response to Flow)
    Re: Current state of aSmack (Smack for Android)

    I need the smack lib in android and are very happy to found your nice jar, but i get a ClassNotFoundException for the org.jivesoftware.smackx.ServiceDiscoveryManager as soon as I try to init smack with SmackAndroid.init(getApplicationContext()); in my main activity.

    That kind of problem comes normaly with a wrong classpath configuration, but in android all you have to do is drop the jar in the libs folder... or so i thought.

    Do you have any suggestions to fix this problem?

     

    best regards

More Like This

  • Retrieving data ...

Bookmarked By (1)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points