messaging - Android: QuickBox chatService.login failure -


i trying use quickbox establish im in application, testing in new project, seems login onsuccess , onerror never triggered. session created login failing (but without error returned), both toasts in onsuccess , onerror never reached.

qbsettings.getinstance().init(getapplicationcontext(), app_id, auth_key, auth_secret);     qbsettings.getinstance().setaccountkey(account_key);     try {         qbauth.getbaseservice().settoken("bede1c97d992755ba5ceae43b76ded687c71a1c2");     } catch (baseserviceexception e) {         e.printstacktrace();     }     qbchatservice.setdebugenabled(true);      qbchatservice.setdefaultconnectiontimeout(60);     final qbchatservice chatservice = qbchatservice.getinstance();     final qbuser user = new qbuser("roudy", "kanaan123");     qbauth.createsession(user, new qbentitycallback<qbsession>() {         @override         public void onsuccess(final qbsession session, bundle params) {             toast.maketext(mainactivity.this, "session created", toast.length_short).show();             user.setid(1);             chatservice.login(user, new qbentitycallback() { // tried qbchatservice.getinstance().login                  @override                 public void onsuccess(object o, bundle bundle) {                     toast.maketext(mainactivity.this, "user logged in", toast.length_short).show();                     privatechatmanager = chatservice.getprivatechatmanager();                     privatechatmanager.createdialog(2, new qbentitycallback<qbdialog>() {                         @override                         public void onsuccess(qbdialog dialog, bundle args) {                             toast.maketext(getbasecontext(), "dialog created", toast.length_long).show();                         }                          @override                         public void onerror(qbresponseexception errors) {                             toast.maketext(getbasecontext(), errors.tostring(), toast.length_long).show();                         }                     });                      privatechatmessagelistener = new qbmessagelistener<qbprivatechat>() {                         @override                         public void processmessage(qbprivatechat privatechat, final qbchatmessage chatmessage) {                          }                          @override                         public void processerror(qbprivatechat privatechat, qbchatexception error, qbchatmessage originmessage) {                          }                     };                      privatechatmanagerlistener = new qbprivatechatmanagerlistener() {                         @override                         public void chatcreated(final qbprivatechat privatechat, final boolean createdlocally) {                             if (!createdlocally) {                                 privatechat.addmessagelistener(privatechatmessagelistener);                             }                         }                     };                     qbchatservice.getinstance().getprivatechatmanager().addprivatechatmanagerlistener(privatechatmanagerlistener);                  }                  @override                 public void onerror(qbresponseexception e) {                     toast.maketext(mainactivity.this, e.tostring(), toast.length_short).show();                 }             });          }          @override         public void onerror(qbresponseexception errors) {             toast.maketext(mainactivity.this, errors.tostring(), toast.length_short).show();         }     }); 

i can see in run/android monitor log:

    07-28 09:21:54.107 16144-16184/com.example.roudy.quickboxtest d/qbasdk: connecting chat: chat.quickblox.com 07-28 09:21:54.143 16144-16167/com.example.roudy.quickboxtest w/egl_emulation: eglsurfaceattrib not implemented 07-28 09:21:54.143 16144-16167/com.example.roudy.quickboxtest w/openglrenderer: failed set egl_swap_behavior on surface 0xa346ec20, error=egl_success 07-28 09:21:54.158 16144-16167/com.example.roudy.quickboxtest v/renderscript: 0xae9b0800 launching thread(s), cpus 4 07-28 09:21:54.466 16144-16198/com.example.roudy.quickboxtest d/smack: sent (0): <stream:stream xmlns='jabber:client' to='chat.quickblox.com' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'> 07-28 09:21:54.661 16144-16199/com.example.roudy.quickboxtest d/smack: recv (0): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='chat.quickblox.com' id='ea0fa35d-e7e1-46d9-88ea-eefab4fd8dbb' version='1.0' xml:lang='en'> 07-28 09:21:54.853 16144-16199/com.example.roudy.quickboxtest d/smack: recv (0): <stream:features><sm xmlns="urn:xmpp:sm:3"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>plain</mechanism><mechanism>anonymous</mechanism></mechanisms><ver xmlns="urn:xmpp:features:rosterver"/><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression></stream:features> 07-28 09:23:54.659 16144-16199/com.example.roudy.quickboxtest d/smack: recv (0): </stream:stream> 07-28 09:23:54.660 16144-16198/com.example.roudy.quickboxtest d/smack: sent (0): <presence id='rm2kq-1' type='unavailable'></presence> 07-28 09:23:54.660 16144-16198/com.example.roudy.quickboxtest d/smack: sent (0): </stream:stream> 

edit: seems i'm getting different error in emulator (i logged out once before createsession , ever since getting this):

07-28 09:45:28.647 5679-5735/com.example.roudy.quickboxtest d/qbasdk: connected. login chat, currentuser jid: 15681103-44582, resource: android_9d191aed08b8ec31 07-28 09:45:28.648 5679-5749/com.example.roudy.quickboxtest d/smack: sent (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='plain'>ade1njgxmtazltq0ntgyagthbmfhbjeymw==</auth> 07-28 09:45:28.835 5679-5750/com.example.roudy.quickboxtest d/smack: recv (0): <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure> 

fixed:

turns out cannot login in main thread, created seperate class implementing runnable , ran in oncreate , worked perfectly.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -