Last Updated on : 2024-10-09 02:51:47download
When the main switch of the push message service is disabled, the app will not receive any alerts, home messages, or notices from the device.
API description
- (void)getPushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | A Boolean value is returned on success callback. false indicates the app cannot receive any alerts, home messages, or notices from the device. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
[[ThingSmartSDK sharedInstance] getPushStatusWithSuccess:^(BOOL result) {
// When result == YES, the push message is enabled.
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getPushStatus(withSuccess: { result in
// When result == YES, the push message is enabled.
}, failure: { error in
})
When the main switch of the push message service is disabled, the app will not receive any alerts, home messages, or notices from the device.
API description
- (void)setPushStatusWithStatus:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
enable | Enable or disable. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setPushStatusWithStatus:enable success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setPushStatusWithStatus(enable, success: {
// Success
}, failure: { error in
})
Check if push device alerts are enabled.
API description
- (void)getDevicePushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, returning a Boolean value. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
[[ThingSmartSDK sharedInstance] getDevicePushStatusWithSuccess:^(BOOL result) {
// When result == YES, the device alerts will be pushed.
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getDevicePushStatus(withSuccess: { result in
// When result == YES, the device alerts will be pushed.
}, failure: { error in
})
Enable or disable push device messages
API description
- (void)setDevicePushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
enable | Enable or disable. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setDevicePushStatusWithStauts:enable success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setDevicePushStatusWithStauts(enable, success: {
// Success
}, failure: { error in
})
Check if push home messages are enabled.
API description
- (void)getFamilyPushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, returning a Boolean value. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
[[ThingSmartSDK sharedInstance] getFamilyPushStatusWithSuccess:^(BOOL result) {
// When result == YES, the home message will be pushed.
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getFamilyPushStatus(withSuccess: { result in
// When result == YES, the home message will be pushed.
}, failure: { error in
})
Enable or disable push home messages
API description
- (void)setFamilyPushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
enable | Enable or disable. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setFamilyPushStatusWithStauts:enable success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setFamilyPushStatusWithStauts(enable, success: {
// Success
}, failure: { error in
})
Check if push notice messages are enabled.
API description
- (void)getNoticePushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, returning a Boolean value. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
[[ThingSmartSDK sharedInstance] getNoticePushStatusWithSuccess:^(BOOL result) {
// When result == YES, the notice message will be pushed.
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getNoticePushStatus(withSuccess: { result in
// When result == YES, the notice message will be pushed.
}, failure: { error in
})
Enable or disable push notice messages
API description
- (void)setNoticePushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
enable | Enable or disable, with YES for enable. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setNoticePushStatusWithStauts:enable success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setNoticePushStatusWithStauts(enable, success: {
// Success
}, failure: { error in
})
Check if push marketing messages are enabled.
API description
- (void)getMarketingPushStatusWithSuccess:(__nullable ThingSuccessBOOL)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, returning a Boolean value. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
[[ThingSmartSDK sharedInstance] getMarketingPushStatusWithSuccess:^(BOOL result) {
// When result == YES, the marketing message will be pushed.
} failure:^(NSError *error) {
}];
Swift:
ThingSmartSDK.sharedInstance().getMarketingPushStatus(withSuccess: { result in
// When result == YES, the marketing message will be pushed.
}, failure: { error in
})
Enable or disable push marketing messages
API description
- (void)setMarketingPushStatusWithStauts:(BOOL)enable success:(__nullable ThingSuccessHandler)success failure:(__nullable ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
enable | Enable or disable. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
BOOL enable = YES;
[[ThingSmartSDK sharedInstance] setMarketingPushStatusWithStauts:enable success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
let enable = true
ThingSmartSDK.sharedInstance().setMarketingPushStatusWithStauts(enable, success: {
// Success
}, failure: { error in
})
API description
- (void)setDeviceDNDSettingStatus:(BOOL)flags success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
flags | Enable or disable. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
BOOL flags = YES;
[messageSetting setDeviceDNDSettingStatus:flags success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
let flags = true
messageSetting.setDeviceDNDSettingStatus(flags, success: {
// Success
}, failure: { error in
})
API description
- (void)getDeviceDNDSettingstatusSuccess:(ThingSuccessBOOL)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, returning a Boolean value. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDeviceDNDSettingstatusSuccess:^(BOOL result){
// When result == YES, DND for messages is enabled.
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
messageSetting.getDeviceDNDSettingstatusSuccess({ result in
// When result == YES, DND for messages is enabled.
}, failure: { error in
})
API description
- (void)getDNDDeviceListSuccess:(ThingSuccessList)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, returning the list of devices in all homes. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDNDDeviceListSuccess:^(NSArray *list){
// Success
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
messageSetting.getDNDDeviceListSuccess({ list in
// Success
}, failure: { error in
})
Retrieve all DND periods, including both recurring and one-time DND settings.
API description
- (void)getAllDNDListWithSuccess:(void(^)(ThingSmartMessageDNDListEntity * _Nullable result))success failure:(ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback, returning an error message. |
Data model of ThingSmartMessageDNDListEntity
Field | Description |
---|---|
periodDNDList | The list of recurring DND periods. |
onceDNDList | The list of one-time DND periods. |
Example
Objective-C:
ThingSmartMessageSetting *setting = [[ThingSmartMessageSetting alloc] init];
[setting getAllDNDListWithSuccess:^(ThingSmartMessageDNDListEntity * _Nullable result) {
} failure:^(NSError *error) {
}];
Swift:
let setting = ThingSmartMessageSetting()
setting.getAllDNDList { result in
} failure: { error in
}
API description
- (void)getDNDListSuccess:(ThingSuccessList)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
success | The success callback, returning an array of time periods. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting getDNDListSuccess:^(NSArray *list){
// Success
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
messageSetting.getDNDListSuccess({ list in
// Success
}, failure: { error in
})
A DND period recurs every week. For example, with a DND period from 8:00 AM to 12:00 PM on Monday to Friday, users will not receive any device alerts.
API description
- (void)addDNDWithDNDRequestModel:(ThingSmartMessageSettingDNDRequestModel *)requestModel success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
requestModel | The request model to add a DND period.
|
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
//ThingSmartMessageSettingDNDRequestModel *requestModel = [[ThingSmartMessageSettingDNDRequestModel alloc] init];
//requestModel.startTime = @"07:10";
//requestModel.endTime = @"23:00";
//requestModel.devIDs = @[@"***",@"***"];
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = @"0000111";
//requestModel.isAllDevIDs = YES;
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
[messageSetting addDNDWithDNDRequestModel:requestModel success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
//let requestModel = ThingSmartMessageSettingDNDRequestModel()
//requestModel.startTime = "07:10"
//requestModel.endTime = "23:00"
//requestModel.devIDs = ["***", "***"]
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = "0000111"
//requestModel.isAllDevIDs = true
//let messageSetting = ThingSmartMessageSetting()
messageSetting.addDND(withDNDRequestModel: requestModel, success: {
// Success
}, failure: { error in
})
One-time DND only works once, blocking users from receiving device alerts for the specified duration.
API description
- (void)addOnceDNDWithRequestModel:(ThingSmartMessageOnceDNDRequestModel *)requestModel
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
requestModel | The request model to add a DND period. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Data model of ThingSmartMessageOnceDNDRequestModel
Field | Description |
---|---|
startTime | The DND start time, in the format "yyyy-MM-dd HH:mm" . |
endTime | The DND end time, in the format "yyyy-MM-dd HH:mm" . |
devIDs | The list of device IDs that the DND period is applied to. |
isAllDevIDs | Indicate if all devices support DND settings. When the value is true , devIDs can be empty. |
Example
Objective-C:
ThingSmartMessageOnceDNDRequestModel *requestModel = [[ThingSmartMessageOnceDNDRequestModel alloc] init];
requestModel.startTime = @"2024-07-01 00:00";
requestModel.endTime = @"2024-07-01 12:00";
requestModel.devIDs = @[@"xx", @"xx"];
requestModel.isAllDevIDs = NO;
ThingSmartMessageSetting *setting = [[ThingSmartMessageSetting alloc] init];
[setting addOnceDNDWithRequestModel:requestModel success:^{
} failure:^(NSError *error) {
}];
Swift:
let requestModel = ThingSmartMessageOnceDNDRequestModel()
requestModel.startTime = "2024-07-01 00:00"
requestModel.endTime = "2024-07-01 12:00"
requestModel.devIDs = ["xx","xx"]
requestModel.isAllDevIDs = false
let setting = ThingSmartMessageSetting()
setting.addOnceDND(with: requestModel) {
} failure: { error in
}
API description
- (void)modifyDNDWithTimerID:(long)timerID DNDRequestModel:(ThingSmartMessageSettingDNDRequestModel *)requestModel success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
timerID | The ID of the DND period. |
requestModel | The request model to add a DND period.
|
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
//ThingSmartMessageSettingDNDRequestModel *requestModel = [[ThingSmartMessageSettingDNDRequestModel alloc] init];
//requestModel.startTime = @"07:10";
//requestModel.endTime = @"23:00";
//requestModel.devIDs = @[@"***",@"***"];
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = @"0000111";
//requestModel.isAllDevIDs = YES;
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
//long timerID = 1108056;
[messageSetting modifyDNDWithTimerID:timerID DNDRequestModel:requestModel success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
//let requestModel = ThingSmartMessageSettingDNDRequestModel()
//requestModel.startTime = "07:10"
//requestModel.endTime = "23:00"
//requestModel.devIDs = ["***", "***"]
//0 means disabled and 1 means enabled. @"0000111" means it is enabled from Friday to Sunday. That's the same thing as index =0 starting on Monday
//requestModel.loops = "0000111"
//requestModel.isAllDevIDs = true
//let messageSetting = ThingSmartMessageSetting()
//let timerID = 1108056
messageSetting.modifyDND(withTimerID: timerID, dndRequestModel: requestModel, success: {
// Success
}, failure: { error in
})
API description
- (void)modifyOnceDNDWithTimerID:(long)timerID
requestModel:(ThingSmartMessageOnceDNDRequestModel *)requestModel
success:(ThingSuccessHandler)success
failure:(ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
timerID | The ID of the DND period. |
requestModel | The request model to modify a DND period. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Data model of ThingSmartMessageOnceDNDRequestModel
Field | Description |
---|---|
startTime | The DND start time, in the format "yyyy-MM-dd HH:mm" . |
endTime | The DND end time, in the format "yyyy-MM-dd HH:mm" . |
devIDs | The list of device IDs that the DND period is applied to. |
isAllDevIDs | Indicate if all devices support DND settings. When the value is true , devIDs can be empty. |
Example
Objective-C:
ThingSmartMessageOnceDNDRequestModel *requestModel = [[ThingSmartMessageOnceDNDRequestModel alloc] init];
requestModel.startTime = @"2024-07-02 18:00";
requestModel.endTime = @"2024-07-03 06:00";
requestModel.isAllDevIDs = YES;
ThingSmartMessageSetting *setting = [[ThingSmartMessageSetting alloc] init];
[setting modifyOnceDNDWithTimerID:123456 requestModel:requestModel success:^{
} failure:^(NSError *error) {
}];
Swift:
let requestModel = ThingSmartMessageOnceDNDRequestModel()
requestModel.startTime = "2024-07-02 18:00"
requestModel.endTime = "2024-07-03 06:00"
requestModel.isAllDevIDs = true
let setting = ThingSmartMessageSetting()
setting.modifyOnceDND(withTimerID: 123456, requestModel: requestModel) {
} failure: { error in
}
API description
- (void)removeDNDWithTimerID:(long)timerID success:(ThingSuccessHandler)success failure:(ThingFailureError)failure
Parameters
Parameter | Description |
---|---|
timerID | The ID of the timer. |
success | The success callback. |
failure | The failure callback, returning an error message. |
Example
Objective-C:
//ThingSmartMessageSetting *messageSetting = [[ThingSmartMessageSetting alloc] init];
//long timerID = 1108056;
[messageSetting removeDNDWithTimerID:timerID success:^{
// Success
} failure:^(NSError *error) {
}];
Swift:
//let messageSetting = ThingSmartMessageSetting()
//let timerID = 1108056
messageSetting.removeDND(withTimerID: timerID, success: {
// Success
}, failure: { error in
})
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback