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
- Java
kotlin
val params = NoDisturbTimeParams(
startTime = "22:00:00",
spanMinutes = 480,
level = NoDisturbTimeLevel.MUTED,
timezone = "Asia/Shanghai"
)
NCEngine.setNoDisturbTime(params) { error ->
// error == null indicates success
}
Java
NoDisturbTimeParams params = new NoDisturbTimeParams(
"22:00:00",
480,
NoDisturbTimeLevel.MUTED,
"Asia/Shanghai");
NCEngine.setNoDisturbTime(params, error -> {
// error == null indicates success
});
| Parameter | Type | Description |
|---|---|---|
startTime | String | Start time in HH:MM:SS format |
spanMinutes | Int | Duration in minutes, range (0, 1440) |
level | NoDisturbTimeLevel | Do Not Disturb level |
timezone | String | Time zone, for example Asia/Shanghai |
Get the Do Not Disturb time range
- Kotlin
- Java
kotlin
NCEngine.getNoDisturbTime { info, error ->
if (error == null && info != null) {
// info.startTime / info.spanMinutes / info.level / info.timezone
}
}
Java
NCEngine.getNoDisturbTime((info, error) -> {
if (error == null && info != null) {
// info.getStartTime() / info.getSpanMinutes() / info.getLevel() / info.getTimezone()
}
});
Remove the Do Not Disturb time range
- Kotlin
- Java
kotlin
NCEngine.removeNoDisturbTime { error ->
// error == null indicates success
}
Java
NCEngine.removeNoDisturbTime(error -> {
// error == null indicates success
});