Response time from APNS

Skip to first unread message

Saranyu Ngaosri

Oct 28, 2020, 7:15:09 AM10/28/20
to pushy
Hello everyone, I have a question about response time from APNS, 
I am trying to send VOIP notification with pushy and this lib works fine But it takes about 20-23 seconds to get the response.
Before, I  tried to send notifications by CURL and got quickly response.

And this is my code

public String sendNotification() throws Exception {
String respon_result = "";
File cert_file = new File("/Certificates2.p12");
final ApnsClient apnsClient = new ApnsClientBuilder().setApnsServer(ApnsClientBuilder.DEVELOPMENT_APNS_HOST)
.setClientCredentials(cert_file, "*******").build();
final ApnsPayloadBuilder payloadBuilder = new SimpleApnsPayloadBuilder();

payloadBuilder.setAlertTitle("Test Voip");
payloadBuilder.setAlertBody("Test Voip by pushy");

final String payload =;

final String token = "******";
final String topic = "";

System.out.println("Payload: " + payload );
final SimpleApnsPushNotification pushNotification = new SimpleApnsPushNotification(token, topic, payload, null,
null, PushType.VOIP);

final PushNotificationFuture<SimpleApnsPushNotification, PushNotificationResponse<SimpleApnsPushNotification>> sendNotificationFuture = apnsClient

try {
final PushNotificationResponse<SimpleApnsPushNotification> pushNotificationResponse = sendNotificationFuture

if (pushNotificationResponse.isAccepted()) {
System.out.println("Push notification accepted by APNs gateway.");
System.out.println("Push notification APNS-ID: " + pushNotificationResponse.getApnsId().toString());
respon_result = "Push notificationaccepted by APNs gateway." + "\n" + "Push notification APNS-ID: "
+ pushNotificationResponse.getApnsId().toString();
} else {s
"Notification rejected by the APNs gateway: " + pushNotificationResponse.getRejectionReason());

pushNotificationResponse.getTokenInvalidationTimestamp().ifPresent(timestamp -> {
System.out.println("\t…and the token is invalid as of " + timestamp);

respon_result = "Notification rejected by the APNs gateway: "
+ pushNotificationResponse.getRejectionReason();
} catch (final ExecutionException e) {
System.err.println("Failed to send push notification.");
respon_result = "Failed to send push notification.";
} finally {
return respon_result;

Reply all
Reply to author
0 new messages