@Override
 public String toString() {
   return String.format(
       "SendableApnsPushNotification [sequenceNumber=%d, token=%s, payload=%s, deliveryInvalidation=%s]",
       this.sequenceNumber,
       TokenUtil.tokenBytesToString(this.pushNotification.getToken()),
       this.pushNotification.getPayload(),
       this.pushNotification.getDeliveryInvalidationTime());
 }
Beispiel #2
0
  /**
   * @param cc
   * @param message
   * @return
   */
  private SimpleApnsPushNotification wrapPayload(Client cc, Payload message) {

    final byte[] token;
    try {
      token = TokenUtil.tokenStringToByteArray(cc.getDeviceToken());
    } catch (MalformedTokenStringException e) {
      logger.error("DeviceToken is Invalid. token=" + cc.getDeviceToken());
      return null;
    }

    Date expireDate = new Date(System.currentTimeMillis() + expireTime);
    SimpleApnsPushNotification notification =
        new SimpleApnsPushNotification(token, message.asJson(), expireDate);
    return notification;
  }