Last Updated on : 2023-05-22 06:38:25
API description
void getMessageList(ITuyaDataCallback<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
TuyaHomeSdk.getMessageInstance().getMessageList(new ITuyaDataCallback<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, ITuyaDataCallback<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
TuyaHomeSdk.getMessageInstance().getMessageList(offset, limit, new ITuyaDataCallback<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 ITuyaDataCallback<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
TuyaHomeSdk.getMessageInstance().getMessageListByMsgType(offset, limit, type, new ITuyaDataCallback<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, ITuyaDataCallback<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
TuyaHomeSdk.getMessageInstance().getMessageListByMsgSrcId(offset, limit, MessageType.MSG_REPORT, msgSrcId, true, new ITuyaDataCallback<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
TuyaHomeSdk.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
TuyaHomeSdk.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 ITuyaDataCallback<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
TuyaHomeSdk.getMessageInstance().requestMessageNew(new ITuyaDataCallback<MessageHasNew>() {
@Override
public void onSuccess(MessageHasNew result) {
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback