QBPrivateChatManager getting null

2019-04-14 11:00发布

问题:

I am getting QBPrivateChatManager as null , I am using following code :

    QBChatService chatService = QBChatService.getIntance();
    privateChatManager = chatService.getPrivateChatManager();

getting privateChatManager as null.

回答1:

You must to create User session first

 QBAuth.createSession(new QBUser("garrysantos", "garrysantospass"), new QBEntityCallbackImpl<QBSession>() {
    @Override
    public void onSuccess(QBSession session, Bundle params) {
        // success
    }

    @Override
    public void onError(List<String> errors) {
        // errors
    }
});

See more : http://quickblox.com/developers/Android_XMPP_Chat_Sample



回答2:

chatService.getInstance().getPrivateChatManager();

is null if you're not logged in ti Chat

so you have to login to chat first and then call this method