添加接口:测试推送

This commit is contained in:
liuchengqian 2022-09-07 15:11:55 +08:00
parent d5dd11ef3a
commit b1c4bba2aa

View File

@ -1,7 +1,9 @@
package com.xkrs.sms;
import com.xiaomi.push.sdk.ErrorCode;
import com.xiaomi.xmpush.server.Constants;
import com.xiaomi.xmpush.server.Message;
import com.xiaomi.xmpush.server.Result;
import com.xiaomi.xmpush.server.Sender;
import com.xkrs.model.entity.FirePointEntity;
import com.xkrs.model.entity.SysUserEntity;
@ -72,6 +74,8 @@ public class PushHelper {
// key和value的字符数不能超过1024, 至多可以设置10个key-value键值对
// messageBuilder.extra("","");
Message message = messageBuilder.build();
sender.sendToUserAccount(message, userAccountList, 3);//根据accountList, 发送消息到指定设备上
Result result = sender.sendToUserAccount(message, userAccountList, 3);//根据accountList, 发送消息到指定设备上
ErrorCode errorCode = result.getErrorCode();
String reason = result.getReason();
}
}