Last Updated on : 2024-05-12 05:07:45download
The device offline notification enables you to:
Get the management class for device offline notifications.
val manager = DeviceBusinessDataManager.getInstance().getDeviceOfflineReminderManager()
Check if the device supports offline notifications by device ID.
manager.getOfflineReminderSupportStatus(deviceId,
object : ResultListener<IsSupportOffLineBean?> {
override fun onFailure(
response: BusinessResponse?,
isSupoort: IsSupportOffLineBean?,
apiName: String?
) {
}
override fun onSuccess(
response: BusinessResponse?,
offLineBean: IsSupportOffLineBean?,
apiName: String?
) {
}
})
If the device supports offline notifications, request the current offline notification status by device ID.
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?
) {
}
})
With the status obtained in the previous step, update the offline notification status with the device ID and offline notification toggle.
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()
}
})
This topic describes the service implementation in the sequence of read and create operations. In real-world projects, you can implement them as needed. For more information, see the Offline Notification Module in the BizBundle SDK Demo.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback