Skip to content

Commit c0765c5

Browse files
authored
Merge pull request #16 from lexiLiu/fix-1.0.0.3
[update]
2 parents a56c8b0 + 88dee8e commit c0765c5

1 file changed

Lines changed: 41 additions & 5 deletions

File tree

README.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,59 @@ public class TestCreatApi {
6262
public class TestPushApi {
6363
//pushApi的创建见上述使用示例:创建API
6464
public PushApi pushApi;
65-
public void test() {
65+
public void test() {
6666
//根据cid进行单推
6767
PushDTO<Audience> pushDTO = new PushDTO<Audience>();
6868
// 设置推送参数
6969
pushDTO.setRequestId(System.currentTimeMillis() + "");
70+
/**** 设置个推通道参数 *****/
7071
PushMessage pushMessage = new PushMessage();
7172
pushDTO.setPushMessage(pushMessage);
7273
GTNotification notification = new GTNotification();
7374
pushMessage.setNotification(notification);
74-
notification.setTitle("标题" + new Date());
75-
notification.setBody("body");
75+
notification.setTitle("个title");
76+
notification.setBody("个body");
7677
notification.setClickType("url");
7778
notification.setUrl("https://www.getui.com");
78-
// 设置接收人信息
79+
/**** 设置个推通道参数,更多参数请查看文档或对象源码 *****/
80+
81+
/**** 设置厂商相关参数 ****/
82+
PushChannel pushChannel = new PushChannel();
83+
pushDTO.setPushChannel(pushChannel);
84+
/*配置安卓厂商参数*/
85+
AndroidDTO androidDTO = new AndroidDTO();
86+
pushChannel.setAndroid(androidDTO);
87+
Ups ups = new Ups();
88+
androidDTO.setUps(ups);
89+
ThirdNotification thirdNotification = new ThirdNotification();
90+
ups.setNotification(thirdNotification);
91+
thirdNotification.setTitle("厂商title");
92+
thirdNotification.setBody("厂商body");
93+
thirdNotification.setClickType("url");
94+
thirdNotification.setUrl("https://www.getui.com");
95+
// 两条消息的notify_id相同,新的消息会覆盖老的消息,取值范围:0-2147483647
96+
// thirdNotification.setNotifyId("11177");
97+
/*配置安卓厂商参数结束,更多参数请查看文档或对象源码*/
98+
99+
/*设置ios厂商参数*/
100+
IosDTO iosDTO = new IosDTO();
101+
pushChannel.setIos(iosDTO);
102+
// 相同的collapseId会覆盖之前的消息
103+
iosDTO.setApnsCollapseId("xxx");
104+
Aps aps = new Aps();
105+
iosDTO.setAps(aps);
106+
Alert alert = new Alert();
107+
aps.setAlert(alert);
108+
alert.setTitle("ios title");
109+
alert.setBody("ios body");
110+
/*设置ios厂商参数结束,更多参数请查看文档或对象源码*/
111+
112+
/*设置接收人信息*/
79113
Audience audience = new Audience();
80114
pushDTO.setAudience(audience);
81115
audience.addCid("xxx");
116+
/*设置接收人信息结束*/
117+
/**** 设置厂商相关参数,更多参数请查看文档或对象源码 ****/
82118

83119
// 进行cid单推
84120
ApiResult<Map<String, Map<String, String>>> apiResult = pushApi.pushToSingleByCid(pushDTO);
@@ -201,4 +237,4 @@ public class TestUserApi {
201237
3. 参数,使用`com.getui.push.v2.sdk.anno.param`包下的参数注解`GtPathParam`/`GtHeaderParam`/`GtQueryParam`/`GtBodyParam`标记参数类型,分别表示HTTP请求中的四种参数: 路径参数/header参数/query参数/body参数
202238

203239
## 其他链接
204-
[个推开发者平台](https://docs.getui.com/)
240+
[个推开发者平台](https://docs.getui.com/)

0 commit comments

Comments
 (0)