- Android
- iOS
- JavaScript
- Flutter
- ReactNative
Set global Mute Notifications for the current user. After it is set successfully, the user no longer receives all offline message pushes. Time periods are supported. If multiple devices set global Mute Notifications for the same user, the most recent successful setting takes effect.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| isMute | boolean | Whether Mute Notifications is enabled | 1.1.0 |
| periods | List<TimePeriod> | Mute Notifications time periods. If empty, Mute Notifications applies all day. | 1.1.0 |
| callback | ISimpleCallback | Result callback | 1.1.0 |
Code Example
List<TimePeriod> list = new ArrayList<>();
TimePeriod p1 = new TimePeriod();
p1.setStartTime("11:22");
p1.setEndTime("23:24");
list.add(p1);
JIM.getInstance().getMessageManager().setMute(true, list, new IMessageManager.ISimpleCallback() {
@Override
public void onSuccess() {
}
@Override
public void onError(int errorCode) {
}
});
Set global Mute Notifications for the current user. After it is set successfully, the user no longer receives all offline message pushes. Time periods are supported. If multiple devices set global Mute Notifications for the same user, the most recent successful setting takes effect.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| isMute | BOOL | Whether Mute Notifications is enabled | 1.1.0 |
| periods | NSArray <JTimePeriod *> | Mute Notifications time periods. If empty, Mute Notifications applies all day. | 1.1.0 |
| completeBlock | Result callback | 1.1.0 |
Code Example
NSMutableArray *a = [NSMutableArray array];
JTimePeriod *p1 = [[JTimePeriod alloc] init];
p1.startTime = @"11:23";
p1.endTime = @"20:40";
[a addObject:p1];
[JIM.shared.messageManager setMute:YES
periods:a
complete:^(JErrorCode errorCode) {
}];
Set global Mute Notifications for the current user. After it is set successfully, the user no longer receives all offline message pushes. Time periods can be configured by time zone. If multiple devices set global Mute Notifications for the same user, the most recent successful setting takes effect.
Parameters
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| params | Object | Yes | None | 1.0.0 | |
| params.type | Number | Yes | None | Mute Notifications type | 1.0.0 |
| params.timezone | String | Required when UndisturbType.DISTURB is used | None | Time zone string, for example: Asia/Shanghai | 1.3.0 |
| params.times | Array | Required when UndisturbType.DISTURB is used | None | Mute Notifications time periods. Multiple periods are supported; see the example. | 1.3.0 |
Code Example
let { UndisturbType } = JIM;
let params = {
type: UndisturbType.DISTURB,
timezone: 'Asia/Shanghai',
times: [
// Mute Notifications from 8:00 a.m. to 12:00 p.m.
{ start: '08:00', end: '12:00' },
// Mute Notifications from 7:00 p.m. to 8:00 p.m.
{ start: '19:00', end: '20:00' },
// Mute Notifications from 11:00 p.m. to 6:00 a.m. the next day
{ start: '23:00', end: '06:00' },
]
};
jim.setAllDisturb(params).then(() => {
console.log('set all disturb successfully');
});
Not supported.
Not supported.