Last Updated on : 2023-04-17 09:04:56download
API description
void getMessageList(IThingDataCallback<List<MessageBean>> callback);
Parameters
Parameter | Description |
---|---|
callback | The success or failure callback. |
Data model of MessageBean
Field | Type | Description |
---|---|---|
dateTime | String | The date and time. |
Icon | String | The URL of the message icon. |
msgTypeContent | String | The name of the message type. |
msgContent | String | The content of the message. |
msgType | Integer | The type of message. |
msgSrcId | String | The device ID. Only an alert has this parameter. |
id | String | The message ID. |
Example
ThingHomeSdk.getMessageInstance().getMessageList(new IThingDataCallback<List<MessageBean>>() {
@Override
public void onSuccess(List<MessageBean> result) {}
@Override
public void onError(String errorCode, String errorMessage) {}
});
API description
void getMessageList(int offset, int limit, IThingDataCallback<MessageListBean> callback);
Parameters
Parameter | Description |
---|---|
offset | The total number of messages already returned. |
limit | The maximum number of entries to be returned per page. |
callback | The success or failure callback. |
Example
ThingHomeSdk.getMessageInstance().getMessageList(offset, limit, new IThingDataCallback<MessageListBean>() {
@Override
public void onSuccess(MessageListBean result) {}
@Override
public void onError(String errorCode, String errorMessage) {}
});
API description
void getMessageListByMsgType(int offset, int limit, MessageType msgType, final IThingDataCallback<MessageListBean> callback);
Parameters
Parameter | Description |
---|---|
offset | The total number of messages already returned. |
limit | The maximum number of entries to be returned per page. |
msgType | The type of message. Valid values:
|
callback | The success or failure callback. |
Example
ThingHomeSdk.getMessageInstance().getMessageListByMsgType(offset, limit, type, new IThingDataCallback<MessageListBean>() {
@Override
public void onSuccess(MessageListBean result) {}
@Override
public void onError(String errorCode, String errorMessage) {}
});
msgSrcId
Returns a list of messages by msgSrcId
. Only the alerts of MSG_REPORT
type are supported.
API description
void getMessageListByMsgSrcId(int offset, int limit, MessageType msgType, String msgSrcId, IThingDataCallback<MessageListBean> callback);
Parameters
Parameter | Description |
---|---|
offset | The entry number starting from which data is returned. |
limit | The number of entries returned per page. |
msgType | The type of message. Only the alerts of MSG_REPORT type are supported. |
msgSrcId | The message group ID. |
callback | The success or failure callback. |
Example
ThingHomeSdk.getMessageInstance().getMessageListByMsgSrcId(offset, limit, MessageType.MSG_REPORT, msgSrcId, true, new IThingDataCallback<MessageListBean>() {
@Override
public void onSuccess(final MessageListBean result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
API description
void deleteMessages(List<String> mIds, IBooleanCallback callback);
Parameters
Parameter | Description |
---|---|
mIds | The list of IDs for the messages to be deleted. |
callback | The success or failure callback. |
Example
ThingHomeSdk.getMessageInstance().deleteMessages(mIds, new IBooleanCallback() {
@Override
public void onSuccess() {
}
@Override
public void onError(String code, String error) {
}
});
API description
void deleteMessageWithType(int msgType, List<String> mIds, List<String> mSrcIds, final IBooleanCallback callback);
Parameters
Parameter | Description |
---|---|
msgType | The type of message. Valid values:
|
mIds | The list of IDs for the messages to be deleted. |
mSrcIds | The list of alert types. An empty value or null represents that alerts are not deleted. |
callback | The success or failure callback. |
mSrcIds
.mIds
. mSrcIds
and mIds
cannot be set in the same request.Example
ThingHomeSdk.getMessageInstance().deleteMessageWithType(msgType, mIds, mSrcIds, new IBooleanCallback() {
@Override
public void onSuccess() {
}
@Override
public void onError(String code, String error) {
}
});
Whether messages are regarded as unread depends on different API requests. In the request for alert details, messages are marked as read. In the request for the list of other message types, the messages are marked as read. Only unread messages are new messages. The field hasNotRead
of MessageBean
indicates this status.
API description
void requestMessageNew(final IThingDataCallback<MessageHasNew> callback);
Parameters
Parameter | Description |
---|---|
callback | The callback. The latest unread messages are returned. |
Data model of MessageHasNew
Field | Type | Description |
---|---|---|
alarm | Boolean | Indicates whether alerts are generated. |
family | Boolean | Indicates whether home messages are generated. |
notification | Boolean | Indicates whether notifications are generated. |
Example
ThingHomeSdk.getMessageInstance().requestMessageNew(new IThingDataCallback<MessageHasNew>() {
@Override
public void onSuccess(MessageHasNew result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback