// 设置推送参数 pushDTO.setRequestId(System.currentTimeMillis() + ""); Settings settings = new Settings(); pushDTO.setSettings(settings); // 消息有效期,走厂商消息必须设置该值 settings.setTtl(3600000); // 设置个推通
// 设置推送参数
pushDTO.setRequestId(System.currentTimeMillis() + "");
Settings settings = new Settings();
pushDTO.setSettings(settings);
// 消息有效期,走厂商消息必须设置该值
settings.setTtl(3600000);
// 设置个推通道参数
com.getui.push.v2.sdk.dto.req.message.PushMessage pushMessage = new com.getui.push.v2.sdk.dto.req.message.PushMessage();
JSONObject object = new JSONObject();
object.put("title",title);
object.put("content",content);
object.put("payload",content);
pushMessage.setTransmission(object.toJSONString());
pushDTO.setPushMessage(pushMessage);
// 设置个推通道参数,更多参数请查看文档或对象源码
// 设置厂商相关参数
PushChannel pushChannel = new PushChannel();
pushDTO.setPushChannel(pushChannel);
// 配置安卓厂商参数
AndroidDTO androidDTO = new AndroidDTO();
Ups ups = new Ups();
ThirdNotification thirdNotification = new ThirdNotification();
thirdNotification.setTitle(title);
thirdNotification.setBody(content);
thirdNotification.setClickType("startapp");
ups.setNotification(thirdNotification);
androidDTO.setUps(ups);
pushChannel.setAndroid(androidDTO);
// 两条消息的notify_id相同,新的消息会覆盖老的消息,取值范围:0-2147483647
// thirdNotification.setNotifyId("11177");
// 配置安卓厂商参数结束,更多参数请查看文档或对象源码
// 设置ios厂商参数
IosDTO iosDTO = new IosDTO();
iosDTO.setAutoBadge("+1");
// 相同的collapseId会覆盖之前的消息
iosDTO.setApnsCollapseId(System.currentTimeMillis()+"");
Aps aps = new Aps();
Alert alert = new Alert();
alert.setTitle(title);
alert.setBody(content);
aps.setAlert(alert);
iosDTO.setAps(aps);
pushChannel.setIos(iosDTO);