java.lang.Object |---com.huawei.wearengine.monitor.MonitorClient public final class MonitorClient extends java.lang.Object |
It indicates a client used for event reporting and status query, for example, it listens for the connection status between a device and the Huawei Health app.
Modifier and Type | Method and Description |
|---|---|
com.huawei.hmf.tasks.Task<MonitorData> | query(Device device, MonitorItem monitorItem) Obtains the value of a specified indicator of a specified device. |
com.huawei.hmf.tasks.Task<java.lang.Void> | register(Device device, java.util.List<MonitorItem> monitorItemList, MonitorListener monitorListener) Registers a monitoring object with a specified device to monitor multiple indicators. |
com.huawei.hmf.tasks.Task<java.lang.Void> | register(Device device, MonitorItem monitorItem, MonitorListener monitorListener) Registers a monitoring object with a specified device to monitor a single indicator. |
com.huawei.hmf.tasks.Task<java.lang.Void> | unregister(MonitorListener monitorListener) Deregisters a registered object. |
public com.huawei.hmf.tasks.Task<java.lang.Void> register(Device device, MonitorItem monitorItem, MonitorListener monitorListener)
It is used to register a monitored object with a specified device to monitor a single indicator.
Parameters:
Parameter Name | Parameter Description |
|---|---|
device | Device object to be monitored specified by your app. |
monitorItem | Indicator type to be monitored and reported |
monitorListener | Callback object to be registered. |
Returns:
A task is returned. Your app can call methods such as addOnSuccessListener and addOnFailureListener to check the task execution result.
Since:
API level 0 (SDK 5.0.0.301)
public com.huawei.hmf.tasks.Task<java.lang.Void> register(Device device, java.util.List<MonitorItem> monitorItemList, MonitorListener monitorListener)
It is used to register an object with a specified device to listen for multiple indicators.
Parameters:
Parameter Name | Parameter Description |
|---|---|
device | Device object to be listened for specified by your app. |
monitorItemList | List of indicator types to be listened for and reported. |
monitorListener | Callback object to be registered. |
Returns:
A task is returned. Your app can call methods such as addOnSuccessListener and addOnFailureListener to check the task execution result.
Since:
API level 0 (SDK 5.0.0.301)
public com.huawei.hmf.tasks.Task<java.lang.Void> unregister(MonitorListener monitorListener)
It is used to deregister a registered object.
Parameters:
Parameter Name | Parameter Description |
|---|---|
monitorListener | Callback object to be deregistered. |
Returns:
A task is returned. Your app can call methods such as addOnSuccessListener and addOnFailureListener to check the task execution result.
Since:
API level 0 (SDK 5.0.0.301)
public com.huawei.hmf.tasks.Task<MonitorData> query(Device device, MonitorItem monitorItem)
It is used to obtain the value of a specified indicator of a specified device.
Parameters:
Parameter Name | Parameter Description |
|---|---|
device | Device object to be queried specified by your app. |
monitorItem | Indicator type to be queried. |
Returns:
The value of a specified indicator of a specified device.
Since:
API level 2 (SDK 5.0.1.300)