Notifications never get delivered though APNS server returns success

76 views
Skip to first unread message

Андрей Еремеев

unread,
Oct 26, 2020, 1:15:31 PM10/26/20
to pushy...@googlegroups.com
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.

Jon Chambers

unread,
Oct 26, 2020, 1:46:15 PM10/26/20
to pushy
If the server is reporting that the notification is accepted, I'm not really sure what else is going on. Could you please provide a link to the PHP code provided by Apple?

-Jon

Andrey Eremeev

unread,
Oct 26, 2020, 2:26:24 PM10/26/20
to pushy
Hi Jon!

Sorry for a confusion. I was wrong and Apple doesn't provide such a script (I've mixed it up with this one for creation push package)
That script uses old fashion binary protocol and connects to ssl://gateway.push.apple.com:2195
I understand that pushy uses HTTP/2 and when I mentioned that php script, I just wanted to emphasize that my devices are ready for getting notification and they aren't causing problems.

Andrey Eremeev

unread,
Oct 27, 2020, 7:41:10 AM10/27/20
to pushy
Ha!
I solved this problem. Everyone who faces similar behavior (pushes sent but not delivered) check out your payload.
In my case I didn't send "url-args" that is required for safari browser.
So pushy works perfectly. Thank you for your effort!
Reply all
Reply to author
Forward
0 new messages