|
hyphenate_SDK3.0 3.9.9.2
hyphenate java IM SDK
|
类 | |
| enum | ChatType |
| enum | Direct |
| class | EMCallbackHolder |
| enum | EMChatRoomMessagePriority |
| enum | Status |
| enum | Type |
Public 成员函数 | |
| Status | status () |
| EMMessage (EMAMessage message) | |
| void | setStatus (Status status) |
| Type | getType () |
| EMMessageBody | getBody () |
| long | getMsgTime () |
| void | setMsgTime (long msgTime) |
| long | localTime () |
| void | setLocalTime (long serverTime) |
| boolean | isNeedGroupAck () |
| void | setIsNeedGroupAck (boolean need) |
| int | groupAckCount () |
| void | setGroupAckCount (int count) |
| void | setIsChatThreadMessage (boolean isChatThreadMessage) |
| boolean | isChatThreadMessage () |
| void | setIsChannelMessage (boolean isChannelMessage) |
| boolean | isChannelMessage () |
| EMChatThread | getChatThread () |
| void | setBody (EMMessageBody body) |
| void | addBody (EMMessageBody body) |
| String | getFrom () |
| void | setFrom (String from) |
| String | getRecaller () |
| void | setTo (String to) |
| String | getTo () |
| String | getMsgId () |
| void | setMsgId (String msgId) |
| synchronized void | setMessageStatusCallback (EMCallBack callback) |
| String | toString () |
| void | setAttribute (String attribute, boolean value) |
| void | setAttribute (String attribute, int value) |
| void | setAttribute (String attribute, long value) |
| void | setAttribute (String attribute, float value) |
| void | setAttribute (String attribute, double value) |
| void | setAttribute (String attribute, JSONObject value) |
| void | setAttribute (String attribute, JSONArray value) |
| void | setAttribute (String attribute, String value) |
| boolean | getBooleanAttribute (String attribute) throws HyphenateException |
| boolean | getBooleanAttribute (String attribute, boolean defaultValue) |
| int | getIntAttribute (String attribute, int defaultValue) |
| long | getLongAttribute (String attribute, long defaultValue) |
| float | getFloatAttribute (String attribute, float defaultValue) |
| double | getDoubleAttribute (String attribute, double defaultValue) |
| int | getIntAttribute (String attribute) throws HyphenateException |
| long | getLongAttribute (String attribute) throws HyphenateException |
| float | getFloatAttribute (String attribute) throws HyphenateException |
| double | getDoubleAttribute (String attribute) throws HyphenateException |
| String | getStringAttribute (String attribute) throws HyphenateException |
| String | getStringAttribute (String attribute, String defaultValue) |
| JSONObject | getJSONObjectAttribute (String attribute) throws HyphenateException |
| JSONArray | getJSONArrayAttribute (String attribute) throws HyphenateException |
| ChatType | getChatType () |
| void | setChatType (ChatType chatType) |
| int | describeContents () |
| void | writeToParcel (Parcel out, int flags) |
| Object | clone () throws CloneNotSupportedException |
| boolean | isAcked () |
| void | setAcked (boolean isAcked) |
| boolean | isDelivered () |
| void | setDelivered (boolean isDelivered) |
| boolean | isUnread () |
| void | setUnread (boolean unread) |
| boolean | isListened () |
| void | setListened (boolean isListened) |
| String | getUserName () |
| void | setDeliverAcked (boolean isDeliverAcked) |
| int | progress () |
| void | setProgress (int progress) |
| Direct | direct () |
| void | setDirection (Direct dir) |
| String | conversationId () |
| Map< String, Object > | ext () |
| List< EMMessageReaction > | getMessageReaction () |
| boolean | isOnlineState () |
| void | setPriority (EMChatRoomMessagePriority priority) |
静态 Public 成员函数 | |
| static EMMessage | createSendMessage (Type type) |
| static EMMessage | createReceiveMessage (Type type) |
| static EMMessage | createTxtSendMessage (String content, String username) |
| static EMMessage | createTextSendMessage (String content, String username) |
| static EMMessage | createVoiceSendMessage (String filePath, int timeLength, String username) |
| static EMMessage | createVoiceSendMessage (Uri filePath, int timeLength, String username) |
| static EMMessage | createImageSendMessage (String filePath, boolean sendOriginalImage, String username) |
| static EMMessage | createImageSendMessage (Uri imgUri, boolean sendOriginalImage, String username) |
| static EMMessage | createVideoSendMessage (String videofilePath, String imageThumbPath, int timeLength, String username) |
| static EMMessage | createVideoSendMessage (Uri videofilePath, String imageThumbPath, int timeLength, String username) |
| static EMMessage | createVideoSendMessage (Uri videofilePath, Uri imageThumbPath, int timeLength, String username) |
| static EMMessage | createLocationSendMessage (double latitude, double longitude, String locationAddress, String buildingName, String username) |
| static EMMessage | createLocationSendMessage (double latitude, double longitude, String locationAddress, String username) |
| static EMMessage | createFileSendMessage (String filePath, String username) |
| static EMMessage | createFileSendMessage (Uri filePath, String username) |
静态 Public 属性 | |
| static final Parcelable.Creator< EMMessage > | CREATOR |
消息对象,表示一条发送或接收到的消息。
例如: 构造一条文本发送消息:
构造一条图片消息:
| void com.hyphenate.chat.EMMessage.addBody | ( | EMMessageBody | body | ) |
| String com.hyphenate.chat.EMMessage.conversationId | ( | ) |
获取会话 ID。
|
static |
创建一个普通文件发送消息。
| filePath | 文件路径。 |
| username | 消息接收方的用户 ID 或群组 ID。 |
|
static |
创建一个普通文件发送消息。
| filePath | 文件路径。 |
| username | 消息接收方的用户 ID 或群组 ID。 |
|
static |
创建一个图片发送消息。
| filePath | 图片路径。 |
| sendOriginalImage | 是否发送原图:
|
| username | 消息接收方的用户 ID 或群 ID。 |
|
static |
创建一个图片发送消息。
| imgUri | 图片 URI。 |
| sendOriginalImage | 是否发送原图:
|
| username | 消息接收方的用户 ID 或群组 ID。 |
|
static |
创建一个位置发送消息。
| latitude | 纬度。 |
| longitude | 经度。 |
| locationAddress | 位置详情。 |
| buildingName | 建筑物名称。 |
| username | 消息接收方的用户 ID 或群组 ID。 |
|
static |
创建一个位置发送消息。
| latitude | 纬度。 |
| longitude | 经度。 |
| locationAddress | 位置详情。 |
| username | 消息接收方的用户 ID 或群组 ID。 |
创建一个接收消息。
| type | 消息类型。 |
创建一个发送消息。
| type | 消息类型。 |
|
static |
创建一个文本发送消息。
| content | 文本内容。 |
| username | 消息接收人的用户 ID 或群组 ID。 |
|
static |
创建一个文本发送消息。
| content | 文本内容。 |
| username | 消息接收人的用户 ID 或群 ID。 |
|
static |
创建一个视频发送消息。
| videofilePath | 视频文件路径。 |
| imageThumbPath | 视频第一帧图缩略图。 |
| timeLength | 视频时间长度,单位为秒。 |
| username | 消息接收方的用户 ID 或群组 ID。 |
|
static |
创建一个视频发送消息。
| videofilePath | 视频文件路径。 |
| imageThumbPath | 视频第一帧图缩略图。 |
| timeLength | 视频时间长度,单位为秒。 |
| username | 消息接收方的用户 ID 或群组 ID。 |
|
static |
创建一个视频发送消息。
| videofilePath | 视频文件路径。 |
| imageThumbPath | 视频第一帧图缩略图。 |
| timeLength | 视频时间长度,单位为秒。 |
| username | 消息接收方的用户 ID 或群组 ID。 |
|
static |
创建一个语音发送消息。
| filePath | 语音文件路径。 |
| timeLength | 语音时间长度,单位为秒。 |
| username | 消息接收人的用户 ID 或群组 ID。 |
|
static |
创建一个语音发送消息。
| filePath | 语音文件 URI。 |
| timeLength | 语音时间长度,单位为秒。 |
| username | 消息接收人的用户 ID 或群组 ID。 |
| Direct com.hyphenate.chat.EMMessage.direct | ( | ) |
| Map< String, Object > com.hyphenate.chat.EMMessage.ext | ( | ) |
获取消息包含的全部扩展字段。
| EMMessageBody com.hyphenate.chat.EMMessage.getBody | ( | ) |
获取消息体。
| boolean com.hyphenate.chat.EMMessage.getBooleanAttribute | ( | String | attribute | ) | throws HyphenateException |
获取 Bool 类型的消息扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| boolean com.hyphenate.chat.EMMessage.getBooleanAttribute | ( | String | attribute, |
| boolean | defaultValue | ||
| ) |
获取 Bool 类型的消息扩展属性。
| attribute | 属性名。 |
| defaultValue | 属性的默认值。 |
| EMChatThread com.hyphenate.chat.EMMessage.getChatThread | ( | ) |
获取子区概览信息。
子区概览信息仅在创建子区后携带。
| ChatType com.hyphenate.chat.EMMessage.getChatType | ( | ) |
获取聊天类型。
| double com.hyphenate.chat.EMMessage.getDoubleAttribute | ( | String | attribute | ) | throws HyphenateException |
获取消息的 Double 类型扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| double com.hyphenate.chat.EMMessage.getDoubleAttribute | ( | String | attribute, |
| double | defaultValue | ||
| ) |
获取消息的 Double 类型扩展属性。
| attribute | 属性名。 |
| defaultValue | 属性的默认值。 |
| float com.hyphenate.chat.EMMessage.getFloatAttribute | ( | String | attribute | ) | throws HyphenateException |
获取消息的 Float 类型扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| float com.hyphenate.chat.EMMessage.getFloatAttribute | ( | String | attribute, |
| float | defaultValue | ||
| ) |
获取消息的 Float 类型扩展属性。
| attribute | 属性名。 |
| defaultValue | 属性的默认值。 |
| String com.hyphenate.chat.EMMessage.getFrom | ( | ) |
获取消息发送方的用户 ID。
| int com.hyphenate.chat.EMMessage.getIntAttribute | ( | String | attribute | ) | throws HyphenateException |
获取消息的 Int 类型扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| int com.hyphenate.chat.EMMessage.getIntAttribute | ( | String | attribute, |
| int | defaultValue | ||
| ) |
获取消息的 Int 类型扩展属性。
| attribute | 属性名。 |
| defaultValue | 默认值。 |
| JSONArray com.hyphenate.chat.EMMessage.getJSONArrayAttribute | ( | String | attribute | ) | throws HyphenateException |
获取消息的 JSONArray 类型扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| JSONObject com.hyphenate.chat.EMMessage.getJSONObjectAttribute | ( | String | attribute | ) | throws HyphenateException |
获取消息的 JSONObject 类型扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| long com.hyphenate.chat.EMMessage.getLongAttribute | ( | String | attribute | ) | throws HyphenateException |
获取消息的 Long 类型扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| long com.hyphenate.chat.EMMessage.getLongAttribute | ( | String | attribute, |
| long | defaultValue | ||
| ) |
获取消息的 Long 类型扩展属性。
| attribute | 属性名。 |
| defaultValue | 属性的默认值。 |
| List< EMMessageReaction > com.hyphenate.chat.EMMessage.getMessageReaction | ( | ) |
获取 Reaction 列表。
| String com.hyphenate.chat.EMMessage.getMsgId | ( | ) |
获取消息的 ID。
| long com.hyphenate.chat.EMMessage.getMsgTime | ( | ) |
获取消息的服务器时间戳。
该时间戳为服务器接收消息的时间。
| String com.hyphenate.chat.EMMessage.getRecaller | ( | ) |
获取消息撤回者的用户 ID。
| String com.hyphenate.chat.EMMessage.getStringAttribute | ( | String | attribute | ) | throws HyphenateException |
获取消息的 String 类型扩展属性。
| attribute | 属性名。 |
| HyphenateException | 如果有异常会在这里抛出,包含错误码和异常原因。详见 com.hyphenate.EMError。 |
| String com.hyphenate.chat.EMMessage.getStringAttribute | ( | String | attribute, |
| String | defaultValue | ||
| ) |
获取消息的 String 类型扩展属性。
| attribute | 属性名。 |
| defaultValue | 默认值。 |
| String com.hyphenate.chat.EMMessage.getTo | ( | ) |
获取消息接收者的用户名。
| Type com.hyphenate.chat.EMMessage.getType | ( | ) |
获取消息类型。
| String com.hyphenate.chat.EMMessage.getUserName | ( | ) |
获取对端用户的 ID:
| int com.hyphenate.chat.EMMessage.groupAckCount | ( | ) |
群消息已读人数。
| boolean com.hyphenate.chat.EMMessage.isAcked | ( | ) |
获取对方是否已读。
true:已读。 -false:未读。 | boolean com.hyphenate.chat.EMMessage.isChannelMessage | ( | ) |
获取消息是否是 channel 消息
| boolean com.hyphenate.chat.EMMessage.isChatThreadMessage | ( | ) |
获取消息是否是子区消息。
true表示是子区消息;false表示不是子区消息。 | boolean com.hyphenate.chat.EMMessage.isDelivered | ( | ) |
获取消息是否成功送达。
true:已送达。false:未送达。 | boolean com.hyphenate.chat.EMMessage.isListened | ( | ) |
获取语音消息是否已听。
true:已听;false:未听。 | boolean com.hyphenate.chat.EMMessage.isNeedGroupAck | ( | ) |
消息是否需要群组已读回执。
true:需要已读回执;false:不需要已读回执。 | boolean com.hyphenate.chat.EMMessage.isOnlineState | ( | ) |
是否为在线消息。
该字段为服务器下发字段,不在本地数据库中存储。对于从数据库读取的消息或拉取的漫游消息,该字段的值默认为 true。
true:是。false:否。 | boolean com.hyphenate.chat.EMMessage.isUnread | ( | ) |
检查消息是否未读。
true: 未读;false: 已读。 | long com.hyphenate.chat.EMMessage.localTime | ( | ) |
获取消息的本地时间戳。
该时间戳为消息的本地创建时间戳。
| int com.hyphenate.chat.EMMessage.progress | ( | ) |
消息中的附件的上传或者下载进度。
消息附件的缩略图不涉及进度信息。
| void com.hyphenate.chat.EMMessage.setAcked | ( | boolean | isAcked | ) |
设置对方是否已读。
该方法由 SDK 调用,而非开发者。
| isAcked | 消息是否已读: -true:已读。 -false:未读。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| boolean | value | ||
| ) |
设置消息的 Bool 类型的扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| double | value | ||
| ) |
设置消息的 Double 类型扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| float | value | ||
| ) |
设置消息的 Float 类型扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| int | value | ||
| ) |
设置消息的 Int 类型扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| JSONArray | value | ||
| ) |
设置消息的 JSONArray 类型扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| JSONObject | value | ||
| ) |
设置消息的 JSONObject 类型扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| long | value | ||
| ) |
设置消息的 Long 类型扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setAttribute | ( | String | attribute, |
| String | value | ||
| ) |
设置消息的 String 类型扩展属性。
| attribute | 属性名。 |
| value | 属性值。 |
| void com.hyphenate.chat.EMMessage.setBody | ( | EMMessageBody | body | ) |
(建议方法)设置消息体。
| body | 消息体。 |
| void com.hyphenate.chat.EMMessage.setChatType | ( | ChatType | chatType | ) |
设置聊天类型。
| chatType | 聊天类型,默认为单聊。详见 ChatType。 |
| void com.hyphenate.chat.EMMessage.setDeliverAcked | ( | boolean | isDeliverAcked | ) |
设置消息已送达标记。
开发者不要调用,由 SDK 内部调用。
| isDeliverAcked |
|
| void com.hyphenate.chat.EMMessage.setDelivered | ( | boolean | isDelivered | ) |
设置消息是否成功送达。
该方法由 SDK 调用,而非开发者。
| isDelivered | 消息是否成功送达。
|
| void com.hyphenate.chat.EMMessage.setFrom | ( | String | from | ) |
设置消息发送方的用户 ID。
| from | 发送方的用户 ID。 |
| void com.hyphenate.chat.EMMessage.setGroupAckCount | ( | int | count | ) |
设置群消息已读人数。
| count | 群消息已读人数。 |
| void com.hyphenate.chat.EMMessage.setIsChannelMessage | ( | boolean | isChannelMessage | ) |
设置是否是 channel 消息
| isChannelMessage |
| void com.hyphenate.chat.EMMessage.setIsChatThreadMessage | ( | boolean | isChatThreadMessage | ) |
设置消息是否是子区消息。
| isChatThreadMessage | - true表示设置成子区消息;
|
| void com.hyphenate.chat.EMMessage.setIsNeedGroupAck | ( | boolean | need | ) |
设置群组消息是否需要已读回执。
| need | 群组消息是否需要已读回执:
|
| void com.hyphenate.chat.EMMessage.setListened | ( | boolean | isListened | ) |
设置语音消息是否已听。
该方法由 SDK 调用,而非开发者。
| isListened | 语音消息是否已听:
|
| void com.hyphenate.chat.EMMessage.setLocalTime | ( | long | serverTime | ) |
设置消息的本地时间戳。
该时间戳为消息的本地创建时间戳。
| serverTime | 消息的本地时间戳。 |
| synchronized void com.hyphenate.chat.EMMessage.setMessageStatusCallback | ( | EMCallBack | callback | ) |
设置消息状态变化的回调。
设置消息状态回调,以便刷新界面。
| callback | 消息状态改变的回调。 |
| void com.hyphenate.chat.EMMessage.setMsgId | ( | String | msgId | ) |
设置本地消息 ID。
| msgId | 消息 ID。 |
| void com.hyphenate.chat.EMMessage.setMsgTime | ( | long | msgTime | ) |
设置消息的服务器时间戳。
该时间戳为服务器接收消息的时间。
| msgTime | 服务器接收消息的时间戳。 |
| void com.hyphenate.chat.EMMessage.setPriority | ( | EMChatRoomMessagePriority | priority | ) |
设置消息优先级 chatroom message priority
| priority |
| void com.hyphenate.chat.EMMessage.setProgress | ( | int | progress | ) |
设置消息中的附件的上传或者下载进度。
对于 app 开发者来说,通常不需要主动设置进度。详见 EMMessage#progress()。
| progress | 消息中的附件的上传或者下载进度,取值范围为 [0,100]。 |
| void com.hyphenate.chat.EMMessage.setStatus | ( | Status | status | ) |
设置消息发送或接收的状态。
| status | 消息的状态。 |
| void com.hyphenate.chat.EMMessage.setTo | ( | String | to | ) |
设置消息的接收方的用户 ID。
| to | 消息接收方的用户 ID。 |
| void com.hyphenate.chat.EMMessage.setUnread | ( | boolean | unread | ) |
设置消息是否未读。
建议在会话中,使用 EMConversation#markAllMessagesAsRead()。
| unread | 消息是否未读:
|
| Status com.hyphenate.chat.EMMessage.status | ( | ) |
获取消息的发送/接收状态。
|
static |