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
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)
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 …
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.
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
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)
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
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
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
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)
Certificate .PEM Open your terminal and tapez Test yourconnection, if failreverifyyour certificat, it’sbad
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.
Receive notification when Application enter in background Informations regarding notification is in userInfo. To readthat, use commande [[userInfoobjectForKey:@"aps"] objectForKey:@"alert"]
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.
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