public static boolean isValidConversation(AVIMConversation conversation) {
    if (conversation == null) {
      LogUtils.d("invalid reason : conversation is null");
      return false;
    }
    if (conversation.getMembers() == null || conversation.getMembers().size() == 0) {
      LogUtils.d("invalid reason : conversation members null or empty");
      return false;
    }
    Object type = conversation.getAttribute(ConversationType.TYPE_KEY);
    if (type == null) {
      LogUtils.d("invalid reason : type is null");
      return false;
    }

    int typeInt = (Integer) type;
    if (typeInt == ConversationType.Single.getValue()) {
      if (conversation.getMembers().size() != 2
          || conversation.getMembers().contains(ChatManager.getInstance().getSelfId()) == false) {
        LogUtils.d("invalid reason : oneToOne conversation not correct");
        return false;
      }
    } else if (typeInt == ConversationType.Group.getValue()) {

    } else {
      LogUtils.d("invalid reason : typeInt wrong");
      return false;
    }
    return true;
  }
 @Override
 public void onMessage(
     AVIMTypedMessage message, AVIMConversation conversation, AVIMClient client) {
   if (chatManager.getSelfId() == null) {
     LogUtils.d("selfId is null, please call setupManagerWithUserId ");
   }
   if (client.getClientId().equals(chatManager.getSelfId())) {
     chatManager.onMessage(message, conversation, client);
   } else {
     // 收到其它的client的消息,可能是上一次别的client登录未正确关闭,这里关边掉。
     client.close(null);
   }
 }
 private void onMessage(
     final AVIMTypedMessage message, final AVIMConversation conversation, AVIMClient imClient) {
   if (message == null || message.getMessageId() == null) {
     LogUtils.d("may be SDK Bug, message or message id is null");
     return;
   }
   if (!ConversationHelper.isValidConversation(conversation)) {
     LogUtils.d("receive msg from invalid conversation");
   }
   if (lookUpConversationById(conversation.getConversationId()) == null) {
     registerConversation(conversation);
   }
   LogUtils.d("receive message, content :", message.getContent());
   roomsTable.insertRoom(message.getConversationId());
   roomsTable.increaseUnreadCount(message.getConversationId());
   MessageEvent messageEvent = new MessageEvent(message, MessageEvent.Type.Come);
   eventBus.post(messageEvent);
   if (currentChattingConvid == null
       || !currentChattingConvid.equals(message.getConversationId())) {
     chatManagerAdapter.shouldShowNotification(context, selfId, conversation, message);
   }
 }