Last Updated on : 2024-05-11 10:24:20download
When a common device stays offline for more than 30 minutes or a low power device is offline for more than 8 hours, both the phone’s push notifications and the app’s Message Center will receive a message.
API description
/**
* Check support for offline notifications
*
* @param devId The device ID.
* @param listener The listener.
*/
fun getOfflineReminderSupportStatus(devId: String?, listener: Business.ResultListener<IsSupportOffLineBean?>)
Parameters
Parameter | Type | Description |
---|---|---|
devId | String | The device ID. |
listener | ResultListener | IsSupportOffLineBean callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceOfflineReminderManager()
manager.getOfflineReminderSupportStatus(deviceId,
object : ResultListener<IsSupportOffLineBean?> {
override fun onFailure(
response: BusinessResponse?,
isSupoort: IsSupportOffLineBean?,
apiName: String?
) {
}
override fun onSuccess(
response: BusinessResponse?,
offLineBean: IsSupportOffLineBean?,
apiName: String?
) {
}
})
Return data (IsSupportOffLineBean
class)
Property | Type | Description |
---|---|---|
offlineReminder | boolean | Check support for offline notifications |
API description
/**
* Get offline notification status
*
* @param devId The device ID.
* @param listener The listener.
*/
fun getOfflineReminderStatus(devId: String?, listener: Business.ResultListener<ArrayList<OffLineStatusBean?>?>)
Parameters
Parameter | Type | Description |
---|---|---|
devId | String | The device ID. |
listener | ResultListener | OffLineStatusBean callback. |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceOfflineReminderManager()
manager.getOfflineReminderStatus(deviceId,
object : ResultListener<ArrayList<OffLineStatusBean?>?> {
override fun onFailure(
response: BusinessResponse?,
p1: ArrayList<OffLineStatusBean?>?,
apiName: String?
) {
}
override fun onSuccess(
response: BusinessResponse?,
statusBeans: ArrayList<OffLineStatusBean?>?,
apiName: String?
) {
}
})
Return data (OffLineStatusBean
class)
Property | Type | Description |
---|---|---|
devId | String | The device ID. |
functionType | int | The method type. |
enabled | boolean | Specifies whether to enable offline notifications. |
dpId | int | The DP ID. |
dpValue | String | The DP value. |
logicRuleId | String | The ID of the logic rule. |
API description
/**
* Update offline notification status
*
* @param devId The device ID.
* @param listener The listener.
*/
fun updateOfflineReminderStatus(devId: String?, isWarn: Boolean, listener: Business.ResultListener<Boolean>)
Parameters
Parameter | Type | Description |
---|---|---|
devId | String | The device ID. |
isOpen | boolean | Specifies whether to enable offline notifications. |
listener | ResultListener | Boolean callback |
Example
val manager = DeviceBusinessDataManager.getInstance().getDeviceOfflineReminderManager()
manager.updateOfflineReminderStatus(deviceId, isOpen, object : ResultListener<Boolean> {
override fun onFailure(response: BusinessResponse?, isOpen: Boolean?, apiName: String?) {
}
override fun onSuccess(response: BusinessResponse?, isOpen: Boolean?, apiName: String?) {
Toast.makeText(
this@DeviceOfflineRemindSettingActivity,
resources.getString(R.string.update_success),
Toast.LENGTH_SHORT
).show()
}
})
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback