Search code examples
androidquickblox

QuickBlox currentSession is always null


I am trying to implement QuickBlox voice calling in my App, following the instruction from instruction from Prepare your application for Android AppFiles gradle_Image

the error message: Attempt to invoke virtual method 'void com.quickblox.videochat.webrtc.QBRTCSession.addSessionCallbacksListener(com.quickblox.videochat.webrtc.callbacks.QBRTCSessionConnectionCallbacks)' on a null object reference

  QBChatService.getInstance().getVideoChatWebRTCSignalingManager()
            .addSignalingManagerListener(new QBVideoChatSignalingManagerListener() {
                @Override
                public void signalingCreated(QBSignaling qbSignaling, boolean createdLocally) {
                    if (!createdLocally) {
                        QBRTCClient.getInstance(getApplicationContext()).addSignaling((QBWebRTCSignaling) qbSignaling);
                    }
                }
            });
    WebRtcSessionManager.getInstance(this).getCurrentSession().addSessionCallbacksListener(this);
    WebRtcSessionManager.getInstance(this).getCurrentSession().addVideoTrackCallbacksListener(this);
    QBRTCClient.getInstance(this).addSessionCallbacksListener(this);
    QBRTCClient.getInstance(this).prepareToProcessCalls();

Solution

  • Before starting call you must be logged in chat QBChatService.getInstance().login(). So, check login to the chat.