简体   繁体   中英

QuickBlox Android NoResponse

I'm developing a simple Android based chat application using QuickBlox. For that I have created a Quickblox Free account. Now sometimes when I try to login to the chat service I get following error. Any idea on this ?

03-15 15:58:37.589  15897-16016/com.ne.chatapp D/QBASDK﹕ Connecting to chat..
03-15 15:58:43.499  15897-16020/com.ne.chatapp D/SMACK﹕ SENT (0): <stream:stream to="chat.quickblox.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
03-15 15:58:48.380  15897-16020/com.ne.chatapp D/SMACK﹕ SENT (0): </stream:stream>
03-15 15:58:48.390  15897-16016/com.ne.chatapp E/Login error1﹕ NoResponseException
03-15 15:58:48.420  15897-15897/com.ne.chatapp E/Login error﹕ NoResponseException

Java code for user authentication

public void AuthenticateUser(String Email,String Password,final Context context)
{
    loginActivity = (LoginActivity)context;
    applicationSingleton = (ApplicationSingleton)loginActivity.getApplication();

    QBChatService.setDebugEnabled(true);
    QBSettings.getInstance().fastConfigInit(GlobalData.APP_ID, GlobalData.AUTH_KEY, GlobalData.AUTH_SECRET);
    if (!QBChatService.isInitialized()) {
        QBChatService.init(context);
    }
    chatService = QBChatService.getInstance();

    final QBUser user = new QBUser();
    user.setLogin(Email);
    user.setPassword(Password);

    QBAuth.createSession(user, new QBEntityCallbackImpl<QBSession>() {
        @Override
        public void onSuccess(QBSession session, Bundle args) {
            user.setId(session.getUserId());
            applicationSingleton.setCurrentUser(user);

            if(chatService.isLoggedIn())
            {
                applicationSingleton.setLoginType(LoginType.UNKNOWN);
                loginActivity.onLoginSuccess();
                return;
            }


            chatService.login(user, new QBEntityCallbackImpl() {
                @Override
                public void onSuccess() {
                    try {
                        chatService.startAutoSendPresence(GlobalData.AUTO_PRESENCE_INTERVAL_IN_SECONDS);
                        applicationSingleton.setChatService(chatService);
                        applicationSingleton.setLoginType(LoginType.NORMAL);
                        loginActivity.onLoginSuccess();

                    } catch (SmackException.NotLoggedInException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onError(List errors) {
                    Log.e("Login error1", errors.get(0).toString());
                    loginActivity.onLoginError(errors);
                }
            });
        }

        @Override
        public void onError(List<String> errors) {
            Log.e("Session : ", errors.get(0).toString());
            loginActivity.onLoginError(errors);
        }
    });

}

Everything is ok. Perhaps it was related with problems on internet connection or XMPP servers.

How often does this problem reproduce\\appear in app Could you reproduce this bug by yourself, if you could please describe the steps to reproduce this bug below?

In timeout case, you can increase timeout by

final static int TIME_OUT=100000;
QBChatService.setDefaultPacketReplyTimeout(TIME_OUT);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM