|
9 | 9 | import cn.jiguang.sdk.bean.push.PushSendParam;
|
10 | 10 | import cn.jiguang.sdk.bean.push.PushSendResult;
|
11 | 11 | import cn.jiguang.sdk.bean.push.audience.Audience;
|
| 12 | +import cn.jiguang.sdk.bean.push.batch.BatchPushParam; |
| 13 | +import cn.jiguang.sdk.bean.push.batch.BatchPushSendParam; |
| 14 | +import cn.jiguang.sdk.bean.push.batch.BatchPushSendResult; |
12 | 15 | import cn.jiguang.sdk.bean.push.message.notification.NotificationMessage;
|
13 | 16 | import cn.jiguang.sdk.bean.push.options.Options;
|
14 | 17 | import cn.jiguang.sdk.bean.push.other.CidGetResult;
|
@@ -254,4 +257,55 @@ public void updateImageFile() {
|
254 | 257 | log.info("result:{}", result);
|
255 | 258 | }
|
256 | 259 |
|
| 260 | + @Test |
| 261 | + public void batchSendByRegistrationId() { |
| 262 | + NotificationMessage.Android android = new NotificationMessage.Android(); |
| 263 | + android.setAlert("this is android alert"); |
| 264 | + android.setTitle("this is android title"); |
| 265 | + NotificationMessage notificationMessage = new NotificationMessage(); |
| 266 | + notificationMessage.setAndroid(android); |
| 267 | + |
| 268 | + BatchPushParam pushParam = new BatchPushParam(); |
| 269 | + pushParam.setTarget("170976fa8b808c38fe7"); |
| 270 | + pushParam.setNotification(notificationMessage); |
| 271 | + pushParam.setPlatform(Arrays.asList(Platform.android, Platform.ios)); |
| 272 | + |
| 273 | + Map<String, BatchPushParam> pushSendParam = new HashMap<>(); |
| 274 | + pushSendParam.put("b266cd5c8544ba09b23733e3-c7f656ad-12a3-4807-a614-9924dc11d79e", pushParam); |
| 275 | + pushSendParam.put("b266cd5c8544ba09b23733e3-0cbee7fc-e7ba-4b87-952e-14c5be18e671", pushParam); |
| 276 | + pushSendParam.put("b266cd5c8544ba09b23733e3-870bec54-f0e7-4ae0-a1f9-f13b4ddd1629", pushParam); |
| 277 | + |
| 278 | + BatchPushSendParam param = new BatchPushSendParam(); |
| 279 | + param.setSendParam(pushSendParam); |
| 280 | + |
| 281 | + BatchPushSendResult result = pushApi.batchSendByRegistrationId(param); |
| 282 | + log.info("result:{}", result); |
| 283 | + } |
| 284 | + |
| 285 | + @Test |
| 286 | + public void batchSendByAlias() { |
| 287 | + NotificationMessage.Android android = new NotificationMessage.Android(); |
| 288 | + android.setAlert("this is android alert"); |
| 289 | + android.setTitle("this is android title"); |
| 290 | + NotificationMessage notificationMessage = new NotificationMessage(); |
| 291 | + notificationMessage.setAndroid(android); |
| 292 | + |
| 293 | + BatchPushParam pushParam = new BatchPushParam(); |
| 294 | + pushParam.setTarget("alias1"); |
| 295 | + pushParam.setNotification(notificationMessage); |
| 296 | + pushParam.setPlatform(Arrays.asList(Platform.android, Platform.ios)); |
| 297 | + |
| 298 | + Map<String, BatchPushParam> pushSendParam = new HashMap<>(); |
| 299 | + pushSendParam.put("b266cd5c8544ba09b23733e3-6386dd3c-87dd-42c8-b721-a184ea323371", pushParam); |
| 300 | + pushSendParam.put("b266cd5c8544ba09b23733e3-999c861b-426c-475d-97c8-0cb884e67dfd", pushParam); |
| 301 | + pushSendParam.put("b266cd5c8544ba09b23733e3-d6296fc1-8e7b-4fdd-81ee-019de077bd97", pushParam); |
| 302 | + |
| 303 | + BatchPushSendParam param = new BatchPushSendParam(); |
| 304 | + param.setSendParam(pushSendParam); |
| 305 | + |
| 306 | + BatchPushSendResult result = pushApi.batchSendByAlias(param); |
| 307 | + log.info("result:{}", result); |
| 308 | + } |
| 309 | + |
| 310 | + |
257 | 311 | }
|
0 commit comments