小米推送配置 channel id,不配置channel id,小米已不允许推送
This commit is contained in:
@@ -1 +1,2 @@
|
||||
xiaomi.appSecret=66nAHUMwmGz042clVI5bVg==
|
||||
xiaomi.appSecret=66nAHUMwmGz042clVI5bVg==
|
||||
xiaomi.channel_id=12720000
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user