全部文档

更新时间: 2020-09-07

# 设置免打扰状态

# 参数说明

输入参数说明

参数 类型 必填 说明
conversationType RCConversationType 会话类型,单聊传入 RCConversationType.Private
targetId String 会话 id,接收方的 userId
isBlocked BOOL 是否屏蔽消息提醒

回调参数说明

error 说明:

参数 类型 说明
status RCConversationNotificationStatus 设置状态
code int 代表本次操作是否成功,0 代表成功表
# 代码示例
RongIMClient.setConversationNotificationStatus(
        conversationType, targetId, true, (int status, int code) {
      developer.log(
          "setConversationNotificationStatus1 status " + status.toString(),
          name: pageName);
      String toast = code == 0 ? "设置免打扰成功" : "设置免打扰失败, 错误码: $code";
      DialogUtil.showAlertDiaLog(context, toast);
    });

已复制
1
2
3
4
5
6
7
8
9

# 获取免打扰状态

# 参数说明

输入参数说明

参数 类型 必填 说明
conversationType RCConversationType 会话类型,单聊传入 RCConversationType.Private
targetId String 接收方的 userId

回调参数说明

回调参数 回调类型 说明
status RCConversationNotificationStatus 会话设置的消息提醒状态
code int 代表本次操作是否成功,0 代表成功
# 代码示例
RongIMClient.getConversationNotificationStatus(
            conversationType, targetId, (int status, int code) {
    if (status == 1) {
    _postLocalNotification(msg, left);
    }
});
已复制
1
2
3
4
5
6

# 获取免打扰状态列表

# 参数说明

输入参数说明

参数 类型 必填 说明
conversationTypeList List 会话类型的数组 需要将 RCConversationType 构建 List

返回参数说明

返回值 返回类型 说明
convertionList List 屏蔽消息提醒的会话 Conversation 的列表
code int 操作结果,0 代表正常
# 代码示例
RongIMClient.getBlockedConversationList(
        [RCConversationType.Private, RCConversationType.Group],
        (List convertionList, int code) {
      String toast = "消息免打扰会话数量:\n ${convertionList.length}";
    });
已复制
1
2
3
4
5

# 设置免打扰时间

# 参数说明

输入参数说明

参数 类型 必填 说明
startTime String 开始消息免打扰时间,格式为 HHMMSS
spanMins int 需要消息免打扰分钟数,
0 < spanMins < 1440
您设置的起始时间是 00:00, 结束时间为 23:59,则 spanMins 为 23 * 60 + 59 = 1339 分钟

回调参数说明

error 说明:

回调参数 回调类型 说明
code int 设置失败的错误码,0 代表操作成功
# 代码示例
RongIMClient.setNotificationQuietHours("09:00:00", 600,
        (int code) {
      String toast = "设置全局屏蔽某个时间段的消息提醒:\n" +
          (code == 0 ? "设置成功" : "设置失败, code:" + code.toString());
      print(toast);
    });
已复制
1
2
3
4
5
6

# 删除免打扰时间

回调参数说明

error 说明:

回调参数 回调类型 说明
code int 设置失败的错误码,0 代表操作成功
# 代码示例
RongIMClient.removeNotificationQuietHours((int code) {
      String toast = "删除已设置的全局时间段消息提醒屏蔽:\n" +
          (code == 0 ? "删除成功" : "删除失败, code:" + code.toString());
      print(toast);
    });
已复制
1
2
3
4
5

文档是否解决您的问题 ?

如果遇到产品相关问题,您可 提交工单 寻求帮助