记得上下班打卡 | git大法好,push需谨慎

Commit 94c34eb5 authored by jiangxiulong's avatar jiangxiulong

推送增加 badge

parent 17b80e87
......@@ -189,6 +189,7 @@ public class AdminUpushServiceImpl extends ServiceImpl<AdminUpushMapper, AdminUp
AdminUpush updatePush = new AdminUpush();
try {
AndroidBroadcast broadcast = new AndroidBroadcast(androidAppkey, androidAppMasterSecret);
broadcast.setBadge(1);
broadcast.setTicker(adminUpush.getPushTitle());
broadcast.setTitle(adminUpush.getPushTitle());
broadcast.setText(adminUpush.getPushContent());
......@@ -257,7 +258,7 @@ public class AdminUpushServiceImpl extends ServiceImpl<AdminUpushMapper, AdminUp
IOSBroadcast broadcast = new IOSBroadcast(iosAppkey, iosAppMasterSecret);
//alert的值设置为字典
broadcast.setAlert(adminUpush.getPushTitle(), "", adminUpush.getPushContent());
broadcast.setBadge(0);
broadcast.setBadge(1);
broadcast.setSound("default");
if (Arrays.asList(LnsEnum.ENV.dev.name(), LnsEnum.ENV.test.name()).contains(environment.getProperty(CurrentUtil.CK_ENV_ACTIVE))) {
broadcast.setTestMode();
......
......@@ -13,7 +13,7 @@ public abstract class AndroidNotification extends UmengNotification {
// Keys can be set in the body level
protected static final HashSet<String> BODY_KEYS = new HashSet<String>(Arrays.asList(new String[]{
"ticker", "title", "text", "builder_id", "icon", "largeIcon", "img", "play_vibrate", "play_lights", "play_sound",
"sound", "after_open", "url", "activity", "custom"}));
"sound", "after_open", "url", "activity", "custom", "badge"}));
public enum DisplayType{
NOTIFICATION{public String getValue(){return "notification";}},///通知:消息送达到用户设备后,由友盟SDK接管处理并在通知栏上显示通知内容。
......@@ -82,6 +82,10 @@ public abstract class AndroidNotification extends UmengNotification {
return true;
}
public void setBadge(Integer badge) throws Exception {
setPredefinedKeyValue("badge", badge);
}
// Set extra key/value for Android notification
public boolean setExtraField(String key, String value) throws Exception {
JSONObject payloadJson = null;
......@@ -103,7 +107,6 @@ public abstract class AndroidNotification extends UmengNotification {
return true;
}
//
public void setDisplayType(DisplayType d) throws Exception {
setPredefinedKeyValue("display_type", d.getValue());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment