Apple notification push

3,258 views

Published on

this ppt explain how use and create a notification on your application in xcode

Published in: Technology, News & Politics
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,258
On SlideShare
0
From Embeds
0
Number of Embeds
44
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Apple notification push

  1. 1. Apple notification push<br />
  2. 2. Summary<br />Example of notification<br />Architecture APN<br />IPHONE Authorization<br />Yourcode in Xcode<br />Myprovider Register<br />Certificate<br />Send a notification<br />Return disableddevices<br />Receive a notification push<br />
  3. 3. Example of notification<br />Exist 2 notification versions : <br /><ul><li> Local Notification Push
  4. 4. Remote Notification Push</li></ul>We work with second type of notification<br />
  5. 5. Architecture APN<br />FeedBack server send notification<br />In JSON. It indicate you, device who uninstall application or device dysfunctional <br />Gateway server receive notification<br />In JSON. After reception, it sends notification to selected device<br />
  6. 6. IPHONE Authorization<br />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)<br />
  7. 7. In yourAppDelegate<br />Always use application:didFinishLaunchingWithOptions: method for launching your application when it have options<br />This method, we ask iphone ID user to receive notification or not …<br />
  8. 8. Your code in Xcode<br />This code sends device identifier to your provider to register them.<br />This code must be always in AppDelegate Application<br />Delegate of UIApplication must be use<br />Next slide presents my code <br />Application:didRegisterForRemoteNotificationsWithDeviceToken must be called;<br />The register always must be made.<br />
  9. 9. My code<br />Function which recover Device ID and remove space blank. After call a function in background<br />Function which send info to your provider. Baseurlregister is my url address of my serveur<br />
  10. 10. My provider<br />My script make in PHP and may be use in other programming language<br />Your server must be accessible (choose a web server much easier)<br />
  11. 11. My PHP code register IDIPHONE<br />
  12. 12. Message Format<br />To transfer a message, you use JSON<br />Format includes alert message, badge, and sound<br />You can use a personalize sound to put in you application <br />
  13. 13. Example<br />This code send a alert message, use a default sound of IPHONE and notify app to 1 <br />Don’t worry to write json, PHP have a function which allow to convert a table to json<br />
  14. 14. certificate<br />Don’t think to send notification without minimum security level<br />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<br />
  15. 15. Create a certificate<br />
  16. 16. certificate<br />After to inform apple of your certificate, we transform it to regroup all information with openssl (download it if you didn’t have it)<br />
  17. 17. Certificate .PEM<br />Open your terminal and tapez<br />Test yourconnection, if failreverifyyour certificat, it’sbad<br />
  18. 18. Send a notification on gateway<br />To communicate with gateway sandbox, we go to create a secured network by using ssl protocol.<br />My script is in php, my certificate recently created must put in folder protected by htacess<br />Warning if you do not protect your certificate, an hacker can send a lot of notification in your place.<br />
  19. 19. Script sendNotif.php<br />
  20. 20. Return disableddevices on feedback.sandbox<br />
  21. 21. Receive a notification push<br /><ul><li>Whenyoureceive a notification, more often you must specify the good view to show
  22. 22. You have 2 options
  23. 23. when application enter in background
  24. 24. when application didn’tstart
  25. 25. When application enter in background you must use thismethod
  26. 26. -(void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
  27. 27. When application start because a notification, our information concerning notification
  28. 28. -(BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions</li></li></ul><li>Receive notification when Application enter in background<br />Informations regarding notification is in userInfo. To readthat, use commande <br />[[userInfoobjectForKey:@"aps"] objectForKey:@"alert"]<br />
  29. 29. Receive notification when application wasn’tstarting<br />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.<br />
  30. 30. Conclusion <br />If there are a lot of mistakes, sorrymyenglishis middle but in the picture, youunderstandusing of push notification.<br />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<br />

×