{"_id":"57878d0d5286030e00589bea","parentDoc":null,"project":"56cecbdb44c5700b0095c03a","user":"56cecbb2e50c9c1b008303eb","githubsync":"","__v":6,"category":{"_id":"56d3693d1660770b0008115a","pages":["56e51ce64ddf0b0e004afbbc","56e51d092d90970e00af1b1a","56e69b0c00ea361700d4fa78","56ea7bdfcf35bf0e00adb91d"],"version":"56cecbdc44c5700b0095c03d","__v":4,"project":"56cecbdb44c5700b0095c03a","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-02-28T21:40:13.300Z","from_sync":false,"order":2,"slug":"ios","title":"iOS"},"version":{"_id":"56cecbdc44c5700b0095c03d","project":"56cecbdb44c5700b0095c03a","__v":10,"createdAt":"2016-02-25T09:39:40.121Z","releaseDate":"2016-02-25T09:39:40.121Z","categories":["56cecbdc44c5700b0095c03e","56d1d2c05ad7ad0b00b7e809","56d1d2fa5ad7ad0b00b7e80a","56d369331660770b00081159","56d3693d1660770b0008115a","56e5361e7990160e002e3fbc","56e5362775eb791700a9c4d2","57a9030947f2f419009188d4","57b4705ee9e4c60e00f6f4c3","5828f5b04774ab0f005179a2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-14T13:01:01.507Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Getting an article URL from a poll notification\"\n}\n[/block]\nSending a poll notification, is a powerful toll to interact with your users. After the user finished clicking on the answer and examining the results, he will press the \"Close\" button. This will invoke a delegate method called `paPopupDismissedWithArticleUrl:(NSString *)articleUrl`. All you need to do is implement the `PAPopupDelegate` with its required method. You can than use the `articleUrl` parameter, in order to take the user to the right page.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Linking a regular notification with a URL\"\n}\n[/block]\nSometimes you will want to attach to a notification, a URL which represent the page that should be loaded, once the user clicked on the notification. You can add this URL by filling the following text input in the admin dashboard, inside the create new regular notification page:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/3PjhpKFWTUHN7HAWHiBP_Screen%20Shot%202016-07-14%20at%204.39.03%20PM.png\",\n        \"Screen Shot 2016-07-14 at 4.39.03 PM.png\",\n        \"578\",\n        \"69\",\n        \"#ced5db\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\nYou can grab this URL in the app, by implementing the following code:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo\\n{\\n    NSString *articleUrl = [[userInfo objectForKey:PANotificationKeySelectedArticle] objectForKey::::at:::\\\"url\\\"]; \\n}\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Setting your own default sound\"\n}\n[/block]\nShould be call **after** register method.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[PushApps setDefaultNotificationSound:@\\\"beep.mp3\\\"];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"4. Tracking article view for better recommendations and statistics\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[PushApps reportArticleView:@\\\"your_article_http_url\\\"];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"5. Custom content recommendations button\"\n}\n[/block]\nWhen using Content Recommendations campaign (organic or promoted), a button, enabling the user to slide the recommendations carousel, will appear under the notification. Use this method to set your own custom text on the button:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"[PushApps setContentRecommendationsButton:@\\\"Click To Slide >>\\\"];\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"advanced-features","type":"basic","title":"Advanced Features"}
[block:api-header] { "type": "basic", "title": "1. Getting an article URL from a poll notification" } [/block] Sending a poll notification, is a powerful toll to interact with your users. After the user finished clicking on the answer and examining the results, he will press the "Close" button. This will invoke a delegate method called `paPopupDismissedWithArticleUrl:(NSString *)articleUrl`. All you need to do is implement the `PAPopupDelegate` with its required method. You can than use the `articleUrl` parameter, in order to take the user to the right page. [block:api-header] { "type": "basic", "title": "2. Linking a regular notification with a URL" } [/block] Sometimes you will want to attach to a notification, a URL which represent the page that should be loaded, once the user clicked on the notification. You can add this URL by filling the following text input in the admin dashboard, inside the create new regular notification page: [block:image] { "images": [ { "image": [ "https://files.readme.io/3PjhpKFWTUHN7HAWHiBP_Screen%20Shot%202016-07-14%20at%204.39.03%20PM.png", "Screen Shot 2016-07-14 at 4.39.03 PM.png", "578", "69", "#ced5db", "" ] } ] } [/block] You can grab this URL in the app, by implementing the following code: [block:code] { "codes": [ { "code": "- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo\n{\n NSString *articleUrl = [[userInfo objectForKey:PANotificationKeySelectedArticle] objectForKey:@\"url\"]; \n}", "language": "objectivec" } ] } [/block] [block:api-header] { "type": "basic", "title": "3. Setting your own default sound" } [/block] Should be call **after** register method. [block:code] { "codes": [ { "code": "[PushApps setDefaultNotificationSound:@\"beep.mp3\"];", "language": "objectivec" } ] } [/block] [block:api-header] { "title": "4. Tracking article view for better recommendations and statistics" } [/block] [block:code] { "codes": [ { "code": "[PushApps reportArticleView:@\"your_article_http_url\"];", "language": "objectivec" } ] } [/block] [block:api-header] { "title": "5. Custom content recommendations button" } [/block] When using Content Recommendations campaign (organic or promoted), a button, enabling the user to slide the recommendations carousel, will appear under the notification. Use this method to set your own custom text on the button: [block:code] { "codes": [ { "code": "[PushApps setContentRecommendationsButton:@\"Click To Slide >>\"];", "language": "objectivec" } ] } [/block]