问题描述
这个是我更改后的 但是还是获取不到 chat listener receive msg from:admin@easemob.com body:{"from":"admin","to":"u_13800138004","bodies":[{"msg":"李17申请加入09 的群组","type":"txt"}],"ext":{"messageType":4}}这是我的获取代码private class NewMessageBroadcastReceiver extends BroadcastReceiver {@Overridepublic void onReceive(Context context, Intent intent) {// 主页面收到消息后,主要为了提示未读,实际消息内容需要到chat页面查看Log.i("message", "聊天消息");if(mSchoolPaperFragment!=null&&mSchoolPaperFragment.isVisible()){((SchoolPaperFragment)mSchoolPaperFragment).refresh();}String from = intent.getStringExtra("from");String msgId = intent.getStringExtra("msgid");EMMessage message = EMChatManager.getInstance().getMessage(msgId);try {Log.i("message", "messagetype == "+message.getJSONObjectAttribute("ext"));} catch (EaseMobException e) {// TODO Auto-generated catch blocke.printStackTrace();}
解决方案
这个发送都没成功把。1:没有写接收对象为单聊还是群聊2:消息内容那里应该为msg,而不是bodies3:接收消息对象应该是数组,而不是直接写参考这个把{"target_type":"users","from":"admin","target":["u_13800138004"],"msg":{"msg":"李17申请加入09 的群组","type":"txt"},"ext":{"messageType":4}}