needReadReceipt
field in V2TimMessage
(Details) and then sends the message to the conversation.V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =await TencentImSDKPlugin.v2TIMManager.getMessageManager().createCustomMessage(data: 'Typing...',);// Set `needReadReceipt` to `true` when sending the messageTencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(id: createCustomMessageRes.data.id, receiver: "", groupID: "groupID",onlineUserOnly: true,needReadReceipt: true);
needReadReceipt
field in V2TIMMessage
(Details). If yes, after the user reads the message, the receiver calls the sendMessageReadReceipts
API (Details) to send a read receipt.V2TimCallback sendMessageReadReceipts = await TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessageReadReceipts(messageIDList: ['msgids']);if(sendMessageReadReceipts.code == 0){// Succeeded}else{// Failed}
onRecvMessageReadReceipts
in V2TimAdvancedMsgListener
(Details) and update the UI based on the notification to display the message as, for example, "Read by two members".onRecvMessageReadReceipts: (List<V2TimMessageReceipt> receiptList) {receiptList.forEach((element) {element.groupID; // Group IDelement.msgID; // Message IDelement.readCount;// Latest read count of the group messageelement.unreadCount;// Latest unread count of the group messageelement.userID; // ID of the other party of the one-to-one message});},
getMessageReadReceipts
API (Details) to pull the message read receipt information.V2TimessageReceipt
field of the message read receipt is as described below:Attribute | Definition | Description |
msgID | Message ID | Unique message ID |
userID | ID of the receiver | If the message is a one-to-one message, this field indicates the ID of the receiver. |
timestamp | Time when the receiver marks the message as read | This field is invalid when a message is read. If the message is a one-to-one message, when the receiver calls the markC2CMessageAsRead API to mark the message as read, the sender will receive the onRecvC2CReadReceipt callback which contains the timestamp information. |
groupID | Group ID | If the message is a group message, this field indicates the group ID. |
readCount | Number of members who have read the group message | If the message is a group message, this field indicates the number of members who have read the message. |
unreadCount | Number of members who have not read the group message | If the message is a group message, this field indicates the number of members who have not read the message. |
V2TimValueCallback<List<V2TimMessageReceipt>> getMessageReadReceipts = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getMessageReadReceipts(messageIDList: []);if(getMessageReadReceipts.code == 0){getMessageReadReceipts.data.forEach((element) {// Parse the group message read receiptelement.groupID;element.msgID;element.readCount;element.timestamp;element.unreadCount;element.userID;});}
getGroupMessageReadMemberList
API (Details) to pull the member list by page.V2TimValueCallback<V2TimGroupMessageReadMemberList> getGroupMessageReadMemberList = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getGroupMessageReadMemberList(messageID: "", filter: GetGroupMessageReadMemberListFilter.V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_READ,);if(getGroupMessageReadMemberList.code == 0){// Get the list of members who have or have not read the group messagegetGroupMessageReadMemberList.data.isFinished;getGroupMessageReadMemberList.data.memberInfoList;getGroupMessageReadMemberList.data.nextSeq;}
Was this page helpful?