// send message protected void sendTextMessage(String content) { if (EaseAtMessageHelper.get().containsAtUsername(content)) { sendAtMessage(content); } else { EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername); sendMessage(message); } }
/** * send @ message, only support group chat message * * @param content */ private void sendAtMessage(String content) { if (chatType != EaseConstant.CHATTYPE_GROUP) { EMLog.e(TAG, "only support group chat message"); return; } EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername); EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername); if (EMClient.getInstance().getCurrentUser().equals(group.getOwner()) && EaseAtMessageHelper.get().containsAtAll(content)) { message.setAttribute( EaseConstant.MESSAGE_ATTR_AT_MSG, EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL); } else { message.setAttribute( EaseConstant.MESSAGE_ATTR_AT_MSG, EaseAtMessageHelper.get() .atListToJsonArray(EaseAtMessageHelper.get().getAtMessageUsernames(content))); } sendMessage(message); }
protected void sendFileMessage(String filePath) { EMMessage message = EMMessage.createFileSendMessage(filePath, toChatUsername); sendMessage(message); }
protected void sendVideoMessage(String videoPath, String thumbPath, int videoLength) { EMMessage message = EMMessage.createVideoSendMessage(videoPath, thumbPath, videoLength, toChatUsername); sendMessage(message); }
protected void sendLocationMessage(double latitude, double longitude, String locationAddress) { EMMessage message = EMMessage.createLocationSendMessage(latitude, longitude, locationAddress, toChatUsername); sendMessage(message); }
protected void sendImageMessage(String imagePath) { EMMessage message = EMMessage.createImageSendMessage(imagePath, false, toChatUsername); sendMessage(message); }
protected void sendVoiceMessage(String filePath, int length) { EMMessage message = EMMessage.createVoiceSendMessage(filePath, length, toChatUsername); sendMessage(message); }
protected void sendBigExpressionMessage(String name, String identityCode) { EMMessage message = EaseCommonUtils.createExpressionMessage(toChatUsername, name, identityCode); sendMessage(message); }
// 发送消息方法 // ========================================================================== protected void sendTextMessage(String content) { EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername); sendMessage(message); }