Skip to content

Instantly share code, notes, and snippets.

@adeel
Created July 26, 2011 01:03
Show Gist options
  • Save adeel/1105682 to your computer and use it in GitHub Desktop.
Save adeel/1105682 to your computer and use it in GitHub Desktop.
Example of sending Apple push notifications with Clojure.
; Depends on [com.notnoop.apns/apns "0.1.6"].
(:import ('com.notnoop.apns APNS))
(defn send-push-notification [device-token message]
(let [service (.build (.withSandboxDestination
(.withCert (APNS/newService) "resources/apns-dev-cert.p12" "password")))
payload (.build (.alertBody (APNS/newPayload) message))]
(.push service device-token payload)))
@pedro380085
Copy link

good times with alertBody

@adeel
Copy link
Author

adeel commented Apr 21, 2022

so true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment