本文整理汇总了Java中com.hyphenate.chat.EMMessage.setChatType方法的典型用法代码示例。如果您正苦于以下问题:Java EMMessage.setChatType方法的具体用法?Java EMMessage.setChatType怎么用?Java EMMessage.setChatType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hyphenate.chat.EMMessage
的用法示例。
在下文中一共展示了EMMessage.setChatType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendMessage
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
protected void sendMessage(EMMessage message){
if (message == null) {
return;
}
if(chatFragmentHelper != null){
//set extension
chatFragmentHelper.onSetMessageAttributes(message);
}
if (chatType == EaseConstant.CHATTYPE_GROUP){
message.setChatType(ChatType.GroupChat);
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
message.setChatType(ChatType.ChatRoom);
}
//send message
EMClient.getInstance().chatManager().sendMessage(message);
//refresh ui
if(isMessageListInited) {
messageList.refreshSelectLast();
}
}
示例2: sendMessage
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
protected void sendMessage(EMMessage message){
if (message == null) {
return;
}
if(chatFragmentHelper != null){
//set extension
chatFragmentHelper.onSetMessageAttributes(message);
}
if (chatType == EaseConstant.CHATTYPE_GROUP){
message.setChatType(EMMessage.ChatType.GroupChat);
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
message.setChatType(EMMessage.ChatType.ChatRoom);
}
//send message
EMClient.getInstance().chatManager().sendMessage(message);
//refresh ui
if(isMessageListInited) {
messageList.refreshSelectLast();
}
}
示例3: sendMessage
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
protected void sendMessage(EMMessage message) {
if (message == null) {
return;
}
if (chatFragmentHelper != null) {
//set extension
chatFragmentHelper.onSetMessageAttributes(message);
}
if (chatType == EaseConstant.CHATTYPE_GROUP) {
message.setChatType(ChatType.GroupChat);
} else if (chatType == EaseConstant.CHATTYPE_CHATROOM) {
message.setChatType(ChatType.ChatRoom);
}
//send message
EMClient.getInstance().chatManager().sendMessage(message);
//refresh ui
if (isMessageListInited) {
messageList.refreshSelectLast();
}
}
示例4: onRequestToJoinAccepted
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onRequestToJoinAccepted(String groupId, String groupName, String accepter) {
String st4 = appContext.getString(R.string.Agreed_to_your_group_chat_application);
// your application was accepted
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(accepter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new EMTextMessageBody(accepter + " " + st4));
msg.setStatus(Status.SUCCESS);
// save accept message
EMClient.getInstance().chatManager().saveMessage(msg);
// notify the accept message
getNotifier().vibrateAndPlayTone(msg);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
示例5: onAutoAcceptInvitationFromGroup
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
@Override
public void onAutoAcceptInvitationFromGroup(String groupId, String inviter, String inviteMessage) {
// got an invitation
String st3 = appContext.getString(R.string.Invite_you_to_join_a_group_chat);
EMMessage msg = EMMessage.createReceiveMessage(Type.TXT);
msg.setChatType(ChatType.GroupChat);
msg.setFrom(inviter);
msg.setTo(groupId);
msg.setMsgId(UUID.randomUUID().toString());
msg.addBody(new EMTextMessageBody(inviter + " " + st3));
msg.setStatus(EMMessage.Status.SUCCESS);
// save invitation as messages
EMClient.getInstance().chatManager().saveMessage(msg);
// notify invitation message
getNotifier().vibrateAndPlayTone(msg);
EMLog.d(TAG, "onAutoAcceptInvitationFromGroup groupId:" + groupId);
broadcastManager.sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED));
}
示例6: receiveRedPacketAckMessage
import com.hyphenate.chat.EMMessage; //导入方法依赖的package包/类
/**
* 使用cmd消息收取领到红包之后的回执消息
*/
public static void receiveRedPacketAckMessage(EMMessage message) {
String senderNickname = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, "");
String receiverNickname = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, "");
String senderId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_ID, "");
String receiverId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_ID, "");
String groupId = message.getStringAttribute(RPConstant.EXTRA_RED_PACKET_GROUP_ID, "");
String currentUser = EMClient.getInstance().getCurrentUser();
//更新UI为 xx领取了你的红包
if (currentUser.equals(senderId) && !receiverId.equals(senderId)) {//如果不是自己领取的红包更新此类消息UI
EMMessage msg = EMMessage.createTxtSendMessage("content", groupId);
msg.setChatType(EMMessage.ChatType.GroupChat);
msg.setFrom(message.getFrom());
if (TextUtils.isEmpty(groupId)) {
msg.setTo(message.getTo());
} else {
msg.setTo(groupId);
}
msg.setMsgId(UUID.randomUUID().toString());
msg.setMsgTime(message.getMsgTime());
msg.setDirection(EMMessage.Direct.RECEIVE);
msg.setUnread(false);//去掉未读的显示
msg.setAttribute(RPConstant.MESSAGE_ATTR_IS_RED_PACKET_ACK_MESSAGE, true);
msg.setAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_NAME, senderNickname);
msg.setAttribute(RPConstant.EXTRA_RED_PACKET_RECEIVER_NAME, receiverNickname);
msg.setAttribute(RPConstant.EXTRA_RED_PACKET_SENDER_ID, senderId);
//保存消息
EMClient.getInstance().chatManager().saveMessage(msg);
}
}