Hello,
I'm just seeking your help.
So I've been struggling the whole day long to send notifications to Safari browser using pushy.
But unfortunately without any success.
My code is quite straightforward (some fragments)
this.apnsClient = new ApnsClientBuilder()
.setApnsServer(ApnsClientBuilder.PRODUCTION_APNS_HOST)
.setClientCredentials(
new ByteArrayInputStream(Base64.getDecoder().decode(apnsProperties.getP12Content())),
apnsProperties.getP12Password())
.build()
SimpleApnsPayloadBuilder payloadBuilder = new SimpleApnsPayloadBuilder();
payloadBuilder.setAlertTitle(notification.getTitle());
payloadBuilder.setAlertBody(notification.getBody());
String payload = payloadBuilder.build();
String sanitizeToken = TokenUtil.sanitizeTokenString(token);
new SimpleApnsPushNotification(sanitizeToken,
apnsProperties.getTopic(),
payload,
Instant.now().plus(DEFAULT_EXPIRATION_PERIOD),
DeliveryPriority.IMMEDIATE,
PushType.ALERT)
apnsClient.sendNotification(apnsNotification)
So far everything looks good. I send a notification and get success code (isAccepted == true) and populated apnsId. But the catch is that those notifications never get delivered.
I've tried it with two different devices and deviceTokens.
But if I send notifications using the php script (that one, which is provided by Apple) both devices get notifications just like a charm every time.
I would very appreciate it if you could give me a hint on how to deal with it.