Java client for Apple's Push Notification Service
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


snap - Java client for Apple's Push Notification Service

  Snap is a scalable thread-safe client for Apple's Push Notification Service.
  Outgoing notifications are queued and sent asynchronously via a persistent
  connection to the notification gateway.

  Join the lambdaWorks-OSS Google Group to discuss this project:

Basic Usage

  PushNotificationClient c = new PushNotificationClient(env, keystore, passwd)
  PushNotification n = c.create(token).alert("Hello World!")

  A PushNotificationClient is designed to be long-lived, and if the connection
  is lost will reconnect until shutdown() is called. Pending notifications
  will be (re)sent afer successful reconnection.


  PushNotificationClient requires a KeyStore containing the private key and
  certificate issued by Apple's Provisioning Portal. The simplest method is
  to generate a PKCS #12 file containing the key & cert, either by exporting
  via Keychain Access on Mac OS X or using openssl's pkcs12 command.

  char[] passwd = "foobar".toCharArray();
  KeyStore keystore = KeyStore.getInstance("PKCS12");
  keystore.load(new FileInputStream("myapp-aps-prod.p12"), passwd);

Feedback Service

  A PushNotificationClient will automatically connect to the APNS Feedback
  Service at a configurable interval and deliver any feedback notifications
  to all registered listeners.

  client.setFeedbackInterval(10, MINUTES)
  client.addFeedbackListener(new FeedbackListener { ... })

Maven Artifacts

  Releases of snap are available in the maven central repository: