return;
}
final iOSVariant iOSVariant = (iOSVariant) variant;
PayloadBuilder builder = APNS.newPayload()
// adding recognized key values
.alertBody(pushMessage.getAlert()) // alert dialog, in iOS
.badge(pushMessage.getBadge()) // little badge icon update;
.sound(pushMessage.getSound()) // sound to be played by app
.category(pushMessage.getActionCategory()); // iOS8: User Action category
// apply the 'content-available:1' value:
if (pushMessage.isContentAvailable()) {
// content-available is for 'silent' notifications and Newsstand
builder = builder.instantDeliveryOrSilentNotification();
}
builder = builder.customFields(pushMessage.getData()); // adding other (submitted) fields
// we are done with adding values here, before building let's check if the msg is too long
if (builder.isTooLong()) {
logger.log(Level.WARNING, "Nothing sent to APNs since the payload is too large");
// invoke the error callback and return, as it is pointless to send something out
callback.onError("message too long for APNs");
return;
}
// all good, let's build the JSON payload for APNs
final String apnsMessage = builder.build();
ApnsService service = buildApnsService(iOSVariant, callback);
if (service != null) {
try {