Last Updated on : 2024-03-04 07:31:44
A device might get offline unexpectedly or do not respond over the network after the device is paired. In this case, you can enable offline alerts for the device. If the device goes offline, it will send a notification to a specified user. To enable this feature, you can subscribe to push notifications.
API description
- (void)getOfflineReminderSupportStatusWithSuccess:(nullable ThingSuccessBOOL)success failure:(nullable ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback. |
Example
Objective-C:
- (void)getCurrentOfflineReminderSupportStatus {
// self.device = [ThingSmartDevice deviceWithDeviceId:@"your_device_id"];
[self.device getOfflineReminderSupportStatusWithSuccess:^(BOOL result) {
NSLog(@"get current offline reminder support status: %d", result);
} failure:^(NSError *error) {
NSLog(@"get current Wifi Info failure: %@", error);
}];
}
Swift:
func getCurrentOfflineReminderSupportStatus() {
device?.getOfflineReminderSupportStatus(success: { status in
print("get current offline reminder support status: \(status)")
}, failure: { (error) in
if let e = error {
print("get current offline reminder support status failure: \(e)")
}
})
}
API description
- (void)getOfflineReminderStatusWithSuccess:(nullable ThingSuccessBOOL)success failure:(nullable ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
success | The success callback. |
failure | The failure callback. |
Example
Objective-C:
- (void)getCurrentOfflineReminderStatus {
// self.device = [ThingSmartDevice deviceWithDeviceId:@"your_device_id"];
[self.device getOfflineReminderStatusWithSuccess:^(BOOL result) {
NSLog(@"get current offline reminder status: %d", result);
} failure:^(NSError *error) {
NSLog(@"get current Wifi Info failure: %@", error);
}];
}
Swift:
func getCurrentOfflineReminderStatus() {
device?.getOfflineReminderStatusWithSuccess(success: { status in
print("get current offline reminder status: \(status)")
}, failure: { (error) in
if let e = error {
print("get current offline reminder status failure: \(e)")
}
})
}
API description
- (void)setOfflineReminderStatus:(BOOL)status success:(nullable ThingSuccessBOOL)success failure:(nullable ThingFailureError)failure;
Parameters
Parameter | Description |
---|---|
status | The status of offline alerts. |
success | The success callback. |
failure | The failure callback. |
Example
Objective-C:
- (void)setOfflineReminderStatus:(BOOL)status {
// self.device = [ThingSmartDevice deviceWithDeviceId:@"your_device_id"];
[self.device setOfflineReminderStatus:status success:^(BOOL result) {
NSLog(@"set Offline Reminder Status: %d", result);
} failure:^(NSError *error) {
NSLog(@"set Offline Reminder Status failure: %@", error);
}];
}
Swift:
func setOfflineReminderStatus(status: Bool) {
device?.getOfflineReminderStatusWithSuccess(success: { status in
print("set offline reminder status: \(status)")
}, failure: { (error) in
if let e = error {
print("set offline reminder status failure: \(e)")
}
})
}
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback