注册

不在聊天界面时,发送过来的消息怎么接受?能看见Logcat中打印出了接收到的消息的信息,但是不知道怎么获取这个消息。

下面是我用另一个用户给这个用户发送的信息,接收时不在聊天界面,能看到Logcat中环信打印出来的消息的信息,但是我不知道该怎样抓取发送过来的消息11-05 17:47:28.370 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:370]: log: level: 1, area: 1, RECV:
                                                         { verison : MSYNC_V1, command : NOTICE, payload : { queue : t1/mobile } }
11-05 17:47:28.374 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:370]: log: level: 1, area: 1, SEND:
                                                         { verison : MSYNC_V1, compress_algorimth : 0, command : SYNC, payload : { queue : t1/mobile } }
11-05 17:47:28.415 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:415]: log: level: 1, area: 1, RECV:
                                                         { verison : MSYNC_V1, command : SYNC, payload : { status : { error_code : 0 }, metas : [ { id : 261024270992279584, timestamp : 1478339249025, ns : CHAT, payload : { chattype : CHAT, from : t1, to : t2, contents : [ { contenttype : TEXT, text : 好 } ] } } ], next_key : 261024270992279584, queue : t1, timestamp : 1478339249096 } }
11-05 17:47:28.416 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:415]: log: level: 1, area: 1, ChatClient::handleSync begin
11-05 17:47:28.418 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:415]: log: level: 1, area: 1, SEND:
                                                         { verison : MSYNC_V1, compress_algorimth : 0, command : SYNC, payload : { key : 261024270992279584, queue : t1 } }
11-05 17:47:28.419 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:416]: log: level: 1, area: 1, ChatClient::notifyChatEvent begin
11-05 17:47:28.463 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:462]: log: level: 1, area: 1, ChatClient::notifyChatEvent complete
11-05 17:47:28.464 23465-23885/com.hsd.asmfsx I/hyphenate_jni: _EMAChatManagerListenerImpl onReceiveMessage
11-05 17:47:28.464 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:462]: log: level: 1, area: 1, ChatClient::handleSync complete
11-05 17:47:28.467 23465-24216/com.hsd.asmfsx D/EMChatManager: convID:t1
11-05 17:47:28.467 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:463]: easemob::EMChatManager::callbackReceievedMessages(const std::vector >&)::__lambda34 : shouldCreate : 1
11-05 17:47:28.468 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:464]: log: level: 1, area: 1, RECV:
                                                         { verison : MSYNC_V1, command : SYNC, payload : { status : { error_code : 0 }, queue : t1, is_last : true, timestamp : 1478339249142 } }
11-05 17:47:28.473 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:464]: log: level: 1, area: 1, ChatClient::handleSync begin
11-05 17:47:28.474 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:464]: log: level: 1, area: 1, ChatClient::handleSync complete
11-05 17:47:28.475 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:28:474]: [EMChatManager] onMessageReceived
11-05 17:47:34.125 23465-23886/com.hsd.asmfsx D/ONE SDK: [2016/11/5 17:47:34:125]: [chatservice] start sticky!
已邀请:
在 mainActivity 里也可以监听 didReceiveMessage 的回调的吧。我是写 iOS 的,我是在 appdelegate 的写的,安卓应该也是一样的。
iOS 接收到消息的回调:
-(void)didReceiveMessages:(NSArray *)aMessages
在需要的界面去注册接收消息
可以参考接收消息文档,进行消息接收http://docs.easemob.com/im/200androidclientintegration/50singlechat#接收消息

 

要回复问题请先登录注册