Skip to main content

Set global Do Not Disturb by time range

The Chat UI SDK supports configuring global Do Not Disturb (quiet hours) by time range.

  • The time range repeats daily until you change or remove it.
  • Each user can have only one global Do Not Disturb configuration. Setting it again overwrites the previous configuration.

Set the Do Not Disturb time range

kotlin
val params = NoDisturbTimeParams(
startTime = "22:00:00",
spanMinutes = 480,
level = NoDisturbTimeLevel.MUTED,
timezone = "Asia/Shanghai"
)

NCEngine.setNoDisturbTime(params) { error ->
// error == null indicates success
}
ParameterTypeDescription
startTimeStringStart time in HH:MM:SS format
spanMinutesIntDuration in minutes, range (0, 1440)
levelNoDisturbTimeLevelDo Not Disturb level
timezoneStringTime zone, for example Asia/Shanghai

Get the Do Not Disturb time range

kotlin
NCEngine.getNoDisturbTime { info, error ->
if (error == null && info != null) {
// info.startTime / info.spanMinutes / info.level / info.timezone
}
}

Remove the Do Not Disturb time range

kotlin
NCEngine.removeNoDisturbTime { error ->
// error == null indicates success
}