public interface DeviceStateCallback
Before calling DeviceManager#registerDeviceStateCallback(String, Map, DeviceStateCallback) to
register device state callbacks, you must first create a class to implement this interface and override the
DeviceStateCallback#onDeviceOffline(DeviceInfo) and DeviceStateCallback#onDeviceOnline(DeviceInfo)
methods.
DeviceStateCallback#onDeviceOnline(DeviceInfo) will be called
to notify your application of the online device information.DeviceStateCallback#onDeviceOffline(DeviceInfo) will be called
to notify your application of the offline device information.DeviceManager#unregisterDeviceStateCallback(String, DeviceStateCallback) to unregister all previously
registered callbacks.| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
onDeviceOffline(DeviceInfo deviceInfo) |
Called when a device being monitored goes offline.
|
void |
onDeviceOnline(DeviceInfo deviceInfo) |
Called when a device being monitored goes online.
|
void onDeviceOffline(DeviceInfo deviceInfo)
If your application needs to be notified when a device goes offline, you must implement the
DeviceStateCallback interface, override this callback, and then call
DeviceManager#registerDeviceStateCallback(String, Map, DeviceStateCallback) to register the callback
object. After being registered, this callback will be invoked when a device goes offline and your application
will be notified of the offline device information.
deviceInfo - Indicates the offline device information. For details, see DeviceInfo.void onDeviceOnline(DeviceInfo deviceInfo)
If your application needs to be notified when a device goes online, you must implement the
DeviceStateCallback interface, override this callback, and then call
DeviceManager#registerDeviceStateCallback(String, Map, DeviceStateCallback) to register the
callback object. After being registered, this callback will be invoked when a device goes online and your
application will be notified of the online device information.
deviceInfo - Indicates the online device information. For details, see DeviceInfo.