小米推送配置 channel id,不配置channel id,小米已不允许推送

This commit is contained in:
imndx
2024-09-25 11:14:12 +08:00
parent b4e693137d
commit 08be5bda52
3 changed files with 13 additions and 1 deletions

View File

@@ -1 +1,2 @@
xiaomi.appSecret=66nAHUMwmGz042clVI5bVg==
xiaomi.appSecret=66nAHUMwmGz042clVI5bVg==
xiaomi.channel_id=12720000

View File

@@ -9,6 +9,7 @@ import org.springframework.context.annotation.PropertySource;
@PropertySource(value = "file:config/xiaomi.properties")
public class XiaomiConfig {
private String appSecret;
private String channelId;
public String getAppSecret() {
return appSecret;
@@ -17,4 +18,12 @@ public class XiaomiConfig {
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
}

View File

@@ -47,6 +47,7 @@ public class XiaomiPush {
.passThrough(1) //透传
.timeToLive(timeToLive)
.enableFlowControl(false)
.extra("channel_id", mConfig.getChannelId())
.build();
} else { //normal or friend
String[] arr = Utility.getPushTitleAndContent(pushMessage);
@@ -63,6 +64,7 @@ public class XiaomiPush {
.passThrough(0)
.timeToLive(timeToLive)
.enableFlowControl(true)
.extra("channel_id", mConfig.getChannelId())
.build();
}