public interface IDeviceStateCallback
Before calling DeviceManager#registerDeviceStateCallback(IDeviceStateCallback)
to register device state callbacks, you must first create a class to implement this interface and
override the IDeviceStateCallback#onDeviceOffline(String, int) and
IDeviceStateCallback#onDeviceOnline(String, int) methods. After device state callbacks are registered,
IDeviceStateCallback#onDeviceOnline(String, int) will be called
when a device on the distributed network is online;
IDeviceStateCallback#onDeviceOffline(String, int) will be called when a device goes offline;
and your application will be notified of the network ID and device type of the device that goes online or offline.
If your application no longer needs to receive these notifications,
you can call DeviceManager#unregisterDeviceStateCallback(IDeviceStateCallback)
to unregister all previously registered callbacks.
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
onDeviceOffline(String deviceId,
int deviceType) |
Called when a device goes offline.
|
void |
onDeviceOnline(String deviceId,
int deviceType) |
Called when a device goes online.
|
void onDeviceOffline(String deviceId, int deviceType)
If your application needs to be notified when a device goes offline,
you should implement the IDeviceStateCallback interface, override this callback,
and then call DeviceManager#registerDeviceStateCallback(IDeviceStateCallback)
void onDeviceOnline(String deviceId, int deviceType)
If your application needs to be notified when a device goes online,
you should implement the IDeviceStateCallback interface, override this callback,
and then call DeviceManager#registerDeviceStateCallback(IDeviceStateCallback)