// 設置推送參數 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);
聲明:所有內容來自互聯網搜索結果,不保證100%準確性,僅供參考。如若本站內容侵犯了原著者的合法權益,可聯系我們進行處理。