This document provides an overview of Apple Push Notification service (APN), including examples of local and remote notifications, the notification architecture with feedback and gateway servers, the authorization process for receiving notifications on iPhone, and code examples for registering devices, sending notifications, and receiving notifications when the app is in the background or is launched. Key steps include generating a certificate, protecting it with OpenSSL, sending notifications to the gateway in JSON format, and handling notifications in specific app delegate methods depending on the app's active state.
2. Summary Example of notification Architecture APN IPHONE Authorization Yourcode in Xcode Myprovider Register Certificate Send a notification Return disableddevices Receive a notification push
5. Architecture APN FeedBack server send notification In JSON. It indicate you, device who uninstall application or device dysfunctional Gateway server receive notification In JSON. After reception, it sends notification to selected device
6. IPHONE Authorization To receive notification in IPHONE, users must accept to notification reception. Once to accept, you must register identifier of IPHONE to send it to corporate server (your provider)
7. In yourAppDelegate Always use application:didFinishLaunchingWithOptions: method for launching your application when it have options This method, we ask iphone ID user to receive notification or not …
8. Your code in Xcode This code sends device identifier to your provider to register them. This code must be always in AppDelegate Application Delegate of UIApplication must be use Next slide presents my code Application:didRegisterForRemoteNotificationsWithDeviceToken must be called; The register always must be made.
9. My code Function which recover Device ID and remove space blank. After call a function in background Function which send info to your provider. Baseurlregister is my url address of my serveur
10. My provider My script make in PHP and may be use in other programming language Your server must be accessible (choose a web server much easier)
12. Message Format To transfer a message, you use JSON Format includes alert message, badge, and sound You can use a personalize sound to put in you application
13. Example This code send a alert message, use a default sound of IPHONE and notify app to 1 Don’t worry to write json, PHP have a function which allow to convert a table to json
14. certificate Don’t think to send notification without minimum security level You must create a security certificate and send it to iphone provisionning portal and recover the new one in iphone provisionning portal of your application. Procedure explained on developer portal, don’t forgot enable notification push service
16. certificate After to inform apple of your certificate, we transform it to regroup all information with openssl (download it if you didn’t have it)
17. Certificate .PEM Open your terminal and tapez Test yourconnection, if failreverifyyour certificat, it’sbad
18. Send a notification on gateway To communicate with gateway sandbox, we go to create a secured network by using ssl protocol. My script is in php, my certificate recently created must put in folder protected by htacess Warning if you do not protect your certificate, an hacker can send a lot of notification in your place.
29. Receive notification when application wasn’tstarting You verify if option isnull. If null, youstart application normallyotherwiseyoutake information insidelauchoptions variable. if user, duringalert notification, close it, youdidn’t have badge on your application execpt in applicationIconeBadge.
30. Conclusion If there are a lot of mistakes, sorrymyenglishis middle but in the picture, youunderstandusing of push notification. Regardingdevolepment i use feedback.sandox and gateway.sandbox and developmentcertificate, but whenyourun in production you must use feedback an and not feedback.sandboxeventhings for gateway. You must have production certificate