小米推送配置 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")
|
@PropertySource(value = "file:config/xiaomi.properties")
|
||||||
public class XiaomiConfig {
|
public class XiaomiConfig {
|
||||||
private String appSecret;
|
private String appSecret;
|
||||||
|
private String channelId;
|
||||||
|
|
||||||
public String getAppSecret() {
|
public String getAppSecret() {
|
||||||
return appSecret;
|
return appSecret;
|
||||||
@@ -17,4 +18,12 @@ public class XiaomiConfig {
|
|||||||
public void setAppSecret(String appSecret) {
|
public void setAppSecret(String appSecret) {
|
||||||
this.appSecret = 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) //透传
|
.passThrough(1) //透传
|
||||||
.timeToLive(timeToLive)
|
.timeToLive(timeToLive)
|
||||||
.enableFlowControl(false)
|
.enableFlowControl(false)
|
||||||
|
.extra("channel_id", mConfig.getChannelId())
|
||||||
.build();
|
.build();
|
||||||
} else { //normal or friend
|
} else { //normal or friend
|
||||||
String[] arr = Utility.getPushTitleAndContent(pushMessage);
|
String[] arr = Utility.getPushTitleAndContent(pushMessage);
|
||||||
@@ -63,6 +64,7 @@ public class XiaomiPush {
|
|||||||
.passThrough(0)
|
.passThrough(0)
|
||||||
.timeToLive(timeToLive)
|
.timeToLive(timeToLive)
|
||||||
.enableFlowControl(true)
|
.enableFlowControl(true)
|
||||||
|
.extra("channel_id", mConfig.getChannelId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user