Пример #1
0
 private static PushPayload buildPushObject_android_tag_alertWithTitle(String alert) {
   return PushPayload.newBuilder()
       .setPlatform(Platform.android())
       .setAudience(Audience.tag("profit4all"))
       .setNotification(Notification.android(alert, TITLE, null))
       .build();
 }
 /**
  * 构建推送对象:平台是 Android,目标是 tag 为 "tag1" 的设备,内容是 Android 通知 ALERT,并且标题为 TITLE。
  *
  * @return
  */
 private static PushPayload buildPushObject_android_tag_alertWithTitle(
     String target, String title, String message) {
   return PushPayload.newBuilder()
       .setPlatform(Platform.android())
       .setAudience(Audience.tag(target))
       .setNotification(Notification.android(title, message, null))
       .build();
 }
Пример #3
0
 @Override
 public boolean sendByTags(String msg, String... tags) {
   PushPayload payload =
       PushPayload.newBuilder()
           .setPlatform(Platform.all())
           .setAudience(Audience.tag(tags))
           .setNotification(Notification.alert(msg))
           .build();
   try {
     PushResult result = jpushClient.sendPush(payload);
     return result.isResultOK();
   } catch (Exception e1) {
     errorLogger.writeErrorLog(e1.getMessage());
     appLogger.error(e1.getMessage(), e1);
     debugLogger.error(e1.getMessage(), e1);
     return false;
   }
 }