V2TIMReceiveMessageOpt
中定义:消息接收选项 | 功能描述 |
ReceiveMsgOptEnum.V2TIM_RECEIVE_MESSAGE | 在线时正常接收消息,离线时接收离线推送通知 |
ReceiveMsgOptEnum.V2TIM_NOT_RECEIVE_MESSAGE | 在线和离线都不接收消息 |
ReceiveMsgOptEnum.V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE | 在线时正常接收消息,离线时不接收离线推送通知 |
V2TIMReceiveMessageOpt
可以实现群消息免打扰:
完全不接收消息
消息接收选项设置为 V2TIM_NOT_RECEIVE_MESSAGE
后,单聊/群聊的任何消息都收不到,会话列表也不会更新。V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE
。V2TIMConversation
中的 unreadCount
(Details) 获取到消息未读数。V2TIMConversation
的 recvOpt
(Details) 判断获取到的消息接收选项为 V2TIM_RECEIVE_NOT_NOTIFY_MESSAGE
时显示小红点而非消息未读数。// 设置在线和离线都不接收消息TencentImSDKPlugin.v2TIMManager.getMessageManager().setC2CReceiveMessageOpt(userIDList: ['user1','user2'], opt: ReceiveMsgOptEnum.V2TIM_NOT_RECEIVE_MESSAGE);
V2TimValueCallback<List<V2TimReceiveMessageOptInfo>> messageOpt = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getC2CReceiveMessageOpt(userIDList: ['user1','user2']);messageOpt.data.forEach((element) {// 接收消息选项element.c2CReceiveMessageOpt;element.userID;});
TencentImSDKPlugin.v2TIMManager.getMessageManager().setGroupReceiveMessageOpt(groupID: "groupID", opt: ReceiveMsgOptEnum.V2TIM_NOT_RECEIVE_MESSAGE);
V2TimValueCallback<List<V2TimGroupInfoResult>> groups = await TencentImSDKPlugin.v2TIMManager.getGroupManager().getGroupsInfo(groupIDList: ['groupID']);groups.data.forEach((element) {// 获取群组的接收消息选项element.groupInfo.recvOpt;});
本页内容是否解决了您的问题?