Skip to content

pushnotification apn send

Matthias Görges edited this page Mar 16, 2015 · 1 revision

pushnotification-apn-send sends an Apple Push Notification message to a device.

Parameter Description
certfile File including the .pem certificate
keyfile File including the .pem private key
password Password for the private key file
token u8vector containing the unique device identifier
msg String to be send
badgenum Optional: Number to be shown on the app icon

Note

http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1 demonstrates the process needed to create the required certificates and provisioning profiles for the Apple Push Notification service.

Example

Example 1: Send two messages given the key files are located in the applications directory.

Convert the .cer file into a .pem file: openssl x509 -in aps_development.cer -inform der -out AppNameCert.pem Convert the private key (.p12 file) into a .pem file: openssl pkcs12 -nocerts -in AppName.p12 -out AppNameKey.pem

(define pushnotification-apn-test
  (let ((token (u8vector 166 240 26 12 90 100 191 58 48 224 18 178 53 157 103 79 
                         156 174 38 103 112 139 18 47 65 174 182 196 16 207 74 2))
        (message "Hello World! This is a test.")
        (message2 "LambdaNative with BadgeNum")
        (certfilename "AppNameCert.pem")
        (keyfilename "AppNameKey.pem")
        (password "AppName-pw"))
    (display (pushnotification-apn-send certfilename keyfilename password token message)) 
    (thread-sleep! 5)
    (display (pushnotification-apn-send certfilename keyfilename password token message2 99)) 
  ))
Clone this wiki locally