官方demo集成IM, 频繁切换前后台导致,点击发送按钮时候无任何数据,异常为:JIGUANG-JMessage: [CommonUtils] [createSendMessage] have not logged in!

Android2013IT
2019-09-04 11:22 642 0
compile 'cn.jiguang.sdk:jmessage:2.9.0'
// 此处以J
compile 'cn.jiguang.sdk:jcore:2.0.0'

发现在demo中有:

 @Override
    protected void onPause() {
        super.onPause();
        JMessageClient.exitConversation();//退出会话。UI层在退出聊天会话界面时调用,清除当前正在聊天的对象,之后收到对应的用户或群组发来的消息时,会正常展示通知栏通知。
        ekBar.reset();
    }

    @Override
    protected void onResume() {
        if (mIsSingle) {
            if (null != mTargetId) {
                String appKey = getIntent().getStringExtra(TARGET_APP_KEY);
                JMessageClient.enterSingleConversation(mTargetId, appKey);//UI层在进入聊天会话界面时调用,设置当前正在聊天的对象,调用此接口之后,收到对应用户发来的消息时,sdk不会弹出通知栏提示。同时还会清掉与该聊天对象会话的未读消息数,以及通知栏通知
            }
        } else if (!isChatRoom) {
            long groupId = getIntent().getLongExtra(GROUP_ID, 0);
            if (groupId != 0) {
                JGApplication.isAtMe.put(groupId, false);
                JGApplication.isAtall.put(groupId, false);
                JMessageClient.enterGroupConversation(groupId);
            }
        }

        //历史消息中删除后返回到聊天界面刷新界面
        if (JGApplication.ids != null && JGApplication.ids.size() > 0) {
            for (Message msg : JGApplication.ids) {
                mChatAdapter.removeMessage(msg);
            }
        }
        if (mChatAdapter != null)
            mChatAdapter.notifyDataSetChanged();
        //发送名片返回聊天界面刷新信息
        if (SharePreferenceManager.getIsOpen()) {
            if (!isChatRoom) {
                initData();
            }
            SharePreferenceManager.setIsOpen(false);
        }
        super.onResume();

    }

日志为:

```
09-04 19:15:46.184 449-449/? D/libEGL: eglTerminate EGLDisplay = 0xbec583bc
09-04 19:15:46.514 1505-2382/? D/InputReader: Input event(9): value=1 when=121710113830000
09-04 19:15:46.514 1505-2382/? D/InputReader: Input event(9): value=1 when=121710113830000
09-04 19:15:46.514 1505-2382/? I/InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.4812 ] when=121710113830000
09-04 19:15:46.514 1505-2382/? D/InputReader: lastThreadEndTime = 121709512776434, currentThreadStartTime = 121709512780340, diff = 0
09-04 19:15:46.514 1505-2381/? I/InputDispatcher: Delivering touch to (2509): action: 0x4, toolType: 1
09-04 19:15:46.514 5852-5852/? D/AutoHideHelper: ###check Single invalid
09-04 19:15:46.514 1505-2381/? I/InputDispatcher: Delivering touch to (5852): action: 0x4, toolType: 1
09-04 19:15:46.514 1505-2381/? I/InputDispatcher: Delivering touch to (9473): action: 0x0, toolType: 1
09-04 19:15:46.514 9473-9473/? D/ViewRootImpl: ViewPostImeInputStage processPointer 0
09-04 19:15:46.594 1505-2382/? D/InputReader: Input event(9): value=0 when=121710198025000
09-04 19:15:46.594 1505-2382/? D/InputReader: Input event(9): value=0 when=121710198025000
09-04 19:15:46.594 1505-2382/? I/InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=121710198025000
09-04 19:15:46.594 1505-2381/? I/InputDispatcher: Delivering touch to (9473): action: 0x1, toolType: 1
09-04 19:15:46.594 9473-9473/? D/ViewRootImpl: ViewPostImeInputStage processPointer 1
09-04 19:15:46.904 1505-2382/? D/InputReader: Input event(9): value=1 when=121710501474000
09-04 19:15:46.904 1505-2382/? D/InputReader: Input event(9): value=1 when=121710501474000
09-04 19:15:46.904 1505-2382/? I/InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.4813 ] when=121710501474000
09-04 19:15:46.904 1505-2382/? D/InputReader: lastThreadEndTime = 121710198709715, currentThreadStartTime = 121710198713413, diff = 0
09-04 19:15:46.904 1505-2381/? I/InputDispatcher: Delivering touch to (2509): action: 0x4, toolType: 1
09-04 19:15:46.904 1505-2381/? I/InputDispatcher: Delivering touch to (5852): action: 0x4, toolType: 1
09-04 19:15:46.904 5852-5852/? D/AutoHideHelper: ###check Single invalid
09-04 19:15:46.904 1505-2381/? I/InputDispatcher: Delivering touch to (30524): action: 0x0, toolType: 1
09-04 19:15:46.904 30524-30524/com.ruiyin.lovelife D/ViewRootImpl: ViewPostImeInputStage processPointer 0
09-04 19:15:46.984 1505-2382/? D/InputReader: Input event(9): value=0 when=121710584284000
09-04 19:15:46.984 1505-2382/? D/InputReader: Input event(9): value=0 when=121710584284000
09-04 19:15:46.984 1505-2382/? I/InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=121710584284000
09-04 19:15:46.984 1505-2381/? I/InputDispatcher: Delivering touch to (30524): action: 0x1, toolType: 1
09-04 19:15:46.984 30524-30524/com.ruiyin.lovelife D/ViewRootImpl: ViewPostImeInputStage processPointer 1
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ╔════════════════════════════════════════════════════════════════════════════════════════
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ║ Thread: main
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ╟────────────────────────────────────────────────────────────────────────────────────────
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ║ ChatActivity$8.onClick (ChatActivity.java:489)
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ║ LogUtils.d (LogUtils.java:28)
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ╟────────────────────────────────────────────────────────────────────────────────────────
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ║ create send message conversation = Conversation{type=single, targetId='111111850318', latestText='jjk', latestType=text, lastMsgDate=1567595682859, unReadMsgCnt=0, msgTableName='msg826939247', targetAppkey='d1ad6fcb29f686c680980518', extra=''}==content==cn.jpush.im.android.api.content.TextContent@bed2c1e
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife D/LoveLife: ╚════════════════════════════════════════════════════════════════════════════════════════
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife E/JIGUANG-JMessage: [CommonUtils] [createSendMessage] have not logged in!
09-04 19:15:46.994 30524-30524/com.ruiyin.lovelife E/JIGUANG-JMessage: [JMessageClient] [sendMessage] message should not be null
09-04 19:15:46.994 449-600/? D/libEGL: eglTerminate EGLDisplay = 0xb694164c
09-04 19:15:46.994 449-600/? D/libEGL: eglTerminate EGLDisplay = 0xb694164c
09-04 19:15:47.004 9473-9473/? D/ViewRootImpl: #3 mView = null
09-04 19:15:47.004 449-10753/? I/SurfaceFlinger: id=4376 Removed QopupWindow (7/10)
09-04 19:15:47.004 449-4780/? I/SurfaceFlinger: id=4376 Removed QopupWindow (-2/10)
09-04 19:15:47.004 449-449/? D/libEGL: eglTerminate EGLDisplay = 0xbec583bc
09-04 19:15:47.034 1505-1505/? D/InputMethodManagerService: [HARDWARE_KEYBOARD] (refreshImeWindowVis) isChineseRegion = true, isFolderPhone= false isFolderOpen = false hardKeyShown = false
09-04 19:15:47.034 1505-1505/? D/InputMethodManagerService: [HARDWARE_KEYBOARD] (refreshImeWindowVis) mImeWindowVis= 3 inputVisible = truehaveHardKeyboard = false hardKeyShown = false
09-04 19:15:47.044 2509-2509/? D/MultiSimUtils: getDualModePINPUKRequest : false
09-04 19:15:47.044 2509-2509/? D/MultiSimUtils: getDualModePINPUKRequest : false
09-04 19:15:47.044 1505-1505/? D/MARsPolicyManager: NotificationListenerService OngoingNotificationPosted : android
09-04 19:15:47.044 5852-5852/? D/EventStateReceiver: [c] IS_VISIBLE_WINDOW #1:true, IS_MOVABLE_KEYPAD:false
09-04 19:15:47.044 5852-5852/? E/EventStateReceiver: mIsOpenIME:true isOpenIME:true
09-04 19:15:47.054 22124-22124/? E/ProxyStatusReceiver: no this type!
09-04 19:15:47.064 2509-2509/? D/MultiSimUtils: getDualModePINPUKRequest : false
09-04 19:15:47.064 2509-2509/? D/StatusBar: getNumberOfActiveSim: 1
09-04 19:15:47.064 2509-2509/? D/StatusBar: ----- contentsUnchanged : true, bigContentsUnchanged - true, headsUpContentsUnchanged - true , publicUnchanged true
09-04 19:15:47.064 2509-2509/? D/MultiSimUtils: getDualModePINPUKRe

1个回答

热门排序
  • 你使用的是哪一个 demo,SDK 包里面的 demo,还是 JChat,是最新下载的吗?

    提供你「登陆成功」-「频繁切换前后台」-「提示未登录」这整个操作的完整的日志信息