Breaking News
Home / Java / How to sent Push Notification for APNS in Java?

How to sent Push Notification for APNS in Java?

  1. import com.notnoop.apns.APNS;
  2. import com.notnoop.apns.ApnsService;
  3.  
  4. ApnsService service =
  5.          APNS.newService()
  6.          .withCert("../config/push-prod-cert.p12", "xyz")
  7.          .withProductionDestination()
  8.           .build();
  9.            
  10.                    
  11.             String payload =
  12.                 APNS.newPayload()
  13.                 .alertBody("This is alert")
  14.                 .badge(0)
  15.                 .sound("default")
  16.                 .build();
  17.  
  18.             String deviceToken = "47ca8f029ccb4aa609fee5d2bd6de800998afa3a2a02817de0e3614f84997c56a";
  19.             service.push(deviceToken, payload);
[pb_builder]

Leave a Reply