Skip to content

Instantly share code, notes, and snippets.

@matzew
Created November 17, 2014 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/35b47c74f8eb6a8353de to your computer and use it in GitHub Desktop.
Save matzew/35b47c74f8eb6a8353de to your computer and use it in GitHub Desktop.
ApnsService service =
APNS.newService()
.withCert("/path/to/production_certificate.p12", "MyProdCertPassword")
.withProductionDestination()
.withDelegate(new ApnsDelegate() {
@Override
public void messageSent(ApnsNotification message, boolean resent) {
}
@Override
public void messageSendFailed(ApnsNotification message, Throwable e) {
logger.severe(message.getDeviceToken().toString(), e);
}
@Override
public void connectionClosed(DeliveryError e, int messageIdentifier) {
logger.severe("Closed: " + e);
}
@Override
public void cacheLengthExceeded(int newCacheLength) {
}
@Override
public void notificationsResent(int resendCount) {
logger.severe("Retry: " + resendCount);
}
})
.build();
String payload = APNS.newPayload().alertBody("YU NO MESSAGE???").build();
List<String> mixedTokens = ....
service.push(mixedTokens, payload);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment