android - Facebook connectivity using Jabber ID -


in app, instead of using saslauthentication such x-facebook-platform, i'm using facebook jabber id method login.

from this reference, got following piece of code

public void connecttofb() throws xmppexception {  connectionconfiguration config = new connectionconfiguration("chat.facebook.com", 5222); config.setsaslauthenticationenabled(true); config.setsecuritymode(securitymode.required); config.setrosterloadedatlogin(true); config.settruststorepath("/system/etc/security/cacerts.bks"); config.settruststorepassword("changeit"); config.settruststoretype("bks"); config.setsendpresence(false); try {     sslcontext sc = sslcontext.getinstance("tls");     sc.init(null, memorizingtrustmanager.getinstancelist(this), new java.security.securerandom());     config.setcustomsslcontext(sc); } catch (generalsecurityexception e) {     log.w("tag", "unable use memorizingtrustmanager", e); } xmppconnection xmpp = new xmppconnection(config); try {     xmpp.connect();     xmpp.login("facebookusername", "****"); // error on line     roster roster = xmpp.getroster();     collection<rosterentry> entries = roster.getentries();     system.out.println("connected!");     system.out.println("\n\n" + entries.size() + " buddy(ies):");     // shows first time onliners---->     string temp[] = new string[50];     int = 0;     (rosterentry entry : entries) {         string user = entry.getuser();         log.i("tag", user);     } } catch (xmppexception e) {     xmpp.disconnect();     e.printstacktrace(); } } 

i used smack 3.3.0 api, uses_internet permission, , steps mentioned there(memorizingtrustmanager).

but i'm getting error.

04-21 15:18:44.589: e/androidruntime(2811): fatal exception: main 04-21 15:18:44.589: e/androidruntime(2811): java.lang.verifyerror: org.jivesoftware.smack.sasl.saslmechanism 04-21 15:18:44.589: e/androidruntime(2811):     @ java.lang.class.getdeclaredconstructors(native method) 04-21 15:18:44.589: e/androidruntime(2811):     @ java.lang.class.getconstructor(class.java:472) 04-21 15:18:44.589: e/androidruntime(2811):     @ org.jivesoftware.smack.saslauthentication.authenticate(saslauthentication.java:314) 04-21 15:18:44.589: e/androidruntime(2811):     @ org.jivesoftware.smack.xmppconnection.login(xmppconnection.java:221) 04-21 15:18:44.589: e/androidruntime(2811):     @ org.jivesoftware.smack.connection.login(connection.java:366) 04-21 15:18:44.589: e/androidruntime(2811):     @ com.activapps.fbchat.mainactivity.connecttofb(mainactivity.java:61) 

having profile www.facebook.com/nizam.cs ; used user id nizam.cs, nizam.cs@facebook.com & nizam.cs@chat.facebook.com login none of worked.

what missing?

i tested on emulator without facebook sdk.

problem solved! :)

the problem smack library used. instead of smack3.3.0, used asmack-android-6.jar which update smack library: smack xep0280 , xep0184.

that solved connectivity problem.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -