QBPrivateChatManager getting null

2019-04-14 11:15发布

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

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

getting privateChatManager as null.

2条回答
虎瘦雄心在
2楼-- · 2019-04-14 11:23
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

查看更多
劳资没心,怎么记你
3楼-- · 2019-04-14 11:31

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

查看更多
登录 后发表回答