{"id":6920,"date":"2014-12-15T09:38:04","date_gmt":"2014-12-15T09:38:04","guid":{"rendered":"http:\/\/mobisoftinfotech.com\/resources\/?p=6920"},"modified":"2015-06-12T09:53:16","modified_gmt":"2015-06-12T09:53:16","slug":"ios-8-interactive-notifications","status":"publish","type":"post","link":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications","title":{"rendered":"iOS 8 Interactive Notifications"},"content":{"rendered":"<div class=\"ios-app-txt\">\n<p>If iOS 7 set the standards high by creating one of the finest operating system, iOS 8 took forward the experience in the best possible manner offering immaculate features to users. One of it is \u2018Interactive Notifications\u2019.<\/p>\n<h3 style=\"margin: 35px 0px 20px;\"><strong>What is Interactive Notification<\/strong><\/h3>\n<p>Interactive Notification allows user to take action on Notification from<br>\nLocked Screen, Banner &amp; Notification Center.<br>\nLets see one by one how it looks.<\/p>\n<ol class=\"iosapp-list\">\n<li><strong>Locked Screen:<\/strong> You receive an actionable Notification on locked screen.<\/li>\n<\/ol>\n<p><noscript><img decoding=\"async\" width=\"606\" height=\"504\" class=\"aligncenter size-full wp-image-6921 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg\" alt=\"locked-screen\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg 606w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen-300x250.jpg 300w\" sizes=\"(max-width: 606px) 100vw, 606px\"><\/noscript><img decoding=\"async\" width=\"606\" height=\"504\" class=\"aligncenter size-full wp-image-6921 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20606%20504%22%3E%3C%2Fsvg%3E\" alt=\"locked-screen\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20606%20504%22%3E%3C%2Fsvg%3E 606w\" sizes=\"(max-width: 606px) 100vw, 606px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg 606w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen-300x250.jpg 300w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg\"><\/p>\n<p>Swipe to the left and you will see actions you have defined in your app.<\/p>\n<p><noscript><img decoding=\"async\" width=\"606\" height=\"194\" class=\"aligncenter size-full wp-image-6922 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app.jpg\" alt=\"Swipe to the left  and you will see actions you have defined in your app\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app.jpg 606w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app-300x96.jpg 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app-604x194.jpg 604w\" sizes=\"(max-width: 606px) 100vw, 606px\"><\/noscript><img decoding=\"async\" width=\"606\" height=\"194\" class=\"aligncenter size-full wp-image-6922 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20606%20194%22%3E%3C%2Fsvg%3E\" alt=\"Swipe to the left  and you will see actions you have defined in your app\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20606%20194%22%3E%3C%2Fsvg%3E 606w\" sizes=\"(max-width: 606px) 100vw, 606px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app.jpg 606w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app-300x96.jpg 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app-604x194.jpg 604w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actions-defined-in-app.jpg\"><\/p>\n<ol class=\"iosapp-list\" start=\"2\">\n<li><strong>Banner :<\/strong> You receive an actionable Notification on locked screen.<\/li>\n<\/ol>\n<p><noscript><img decoding=\"async\" width=\"606\" height=\"371\" class=\"aligncenter size-full wp-image-6923  img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actionable-notification.jpg\" alt=\"actionable notification on locked screen\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actionable-notification.jpg 606w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actionable-notification-300x183.jpg 300w\" sizes=\"(max-width: 606px) 100vw, 606px\"><\/noscript><img decoding=\"async\" width=\"606\" height=\"371\" class=\"aligncenter size-full wp-image-6923  img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20606%20371%22%3E%3C%2Fsvg%3E\" alt=\"actionable notification on locked screen\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20606%20371%22%3E%3C%2Fsvg%3E 606w\" sizes=\"(max-width: 606px) 100vw, 606px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actionable-notification.jpg 606w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actionable-notification-300x183.jpg 300w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/actionable-notification.jpg\"><\/p>\n<p>Pull down the banner<\/p>\n<p><noscript><img decoding=\"async\" width=\"609\" height=\"209\" class=\"aligncenter size-full wp-image-6924 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/pull-down-the-banner-img.jpg\" alt=\"pull-down-the-banner-img\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/pull-down-the-banner-img.jpg 609w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/pull-down-the-banner-img-300x102.jpg 300w\" sizes=\"(max-width: 609px) 100vw, 609px\"><\/noscript><img decoding=\"async\" width=\"609\" height=\"209\" class=\"aligncenter size-full wp-image-6924 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20609%20209%22%3E%3C%2Fsvg%3E\" alt=\"pull-down-the-banner-img\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20609%20209%22%3E%3C%2Fsvg%3E 609w\" sizes=\"(max-width: 609px) 100vw, 609px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/pull-down-the-banner-img.jpg 609w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/pull-down-the-banner-img-300x102.jpg 300w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/pull-down-the-banner-img.jpg\"><\/p>\n<ol class=\"iosapp-list\" start=\"3\">\n<li><strong>Notification Center : <\/strong>Check previously missed actionable notification in notification center.<\/li>\n<\/ol>\n<p><noscript><img decoding=\"async\" width=\"613\" height=\"379\" class=\"aligncenter size-full wp-image-6926 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center.jpg\" alt=\"notifications-center\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center.jpg 613w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-300x185.jpg 300w\" sizes=\"(max-width: 613px) 100vw, 613px\"><\/noscript><img decoding=\"async\" width=\"613\" height=\"379\" class=\"aligncenter size-full wp-image-6926 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20613%20379%22%3E%3C%2Fsvg%3E\" alt=\"notifications-center\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20613%20379%22%3E%3C%2Fsvg%3E 613w\" sizes=\"(max-width: 613px) 100vw, 613px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center.jpg 613w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-300x185.jpg 300w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center.jpg\"><\/p>\n<p>swipe to left<\/p>\n<p><noscript><img decoding=\"async\" width=\"610\" height=\"348\" class=\"aligncenter size-full wp-image-6928 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-swipe-left.jpg\" alt=\"notifications-center-swipe-left\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-swipe-left.jpg 610w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-swipe-left-300x171.jpg 300w\" sizes=\"(max-width: 610px) 100vw, 610px\"><\/noscript><img decoding=\"async\" width=\"610\" height=\"348\" class=\"aligncenter size-full wp-image-6928 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20610%20348%22%3E%3C%2Fsvg%3E\" alt=\"notifications-center-swipe-left\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20610%20348%22%3E%3C%2Fsvg%3E 610w\" sizes=\"(max-width: 610px) 100vw, 610px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-swipe-left.jpg 610w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-swipe-left-300x171.jpg 300w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/notifications-center-swipe-left.jpg\"><\/p>\n<ol class=\"iosapp-list\" start=\"4\">\n<li><strong>Modal Alert :<\/strong> Model alert will only be displayed when it is set from Setting App -&gt; Notification -&gt; &lt;App Name&gt; -&gt; Alert Style (Alert). If Yes you will see an Alert instead of a banner.<\/li>\n<\/ol>\n<p><noscript><img decoding=\"async\" width=\"595\" height=\"311\" class=\"aligncenter size-full wp-image-6930 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/modal-alert.jpg\" alt=\"modal-alert\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/modal-alert.jpg 595w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/modal-alert-300x156.jpg 300w\" sizes=\"(max-width: 595px) 100vw, 595px\"><\/noscript><img decoding=\"async\" width=\"595\" height=\"311\" class=\"aligncenter size-full wp-image-6930 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20595%20311%22%3E%3C%2Fsvg%3E\" alt=\"modal-alert\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20595%20311%22%3E%3C%2Fsvg%3E 595w\" sizes=\"(max-width: 595px) 100vw, 595px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/modal-alert.jpg 595w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/modal-alert-300x156.jpg 300w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/modal-alert.jpg\"><\/p>\n<p>Select Options displays new alerts with all the action defined for the App.<\/p>\n<p><noscript><img decoding=\"async\" width=\"589\" height=\"708\" class=\"aligncenter size-full wp-image-6931 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/alerts-with-action-defined-for-app.jpg\" alt=\"alerts-with-action-defined-for-app\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/alerts-with-action-defined-for-app.jpg 589w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/alerts-with-action-defined-for-app-249x300.jpg 249w\" sizes=\"(max-width: 589px) 100vw, 589px\"><\/noscript><img decoding=\"async\" width=\"589\" height=\"708\" class=\"aligncenter size-full wp-image-6931 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20589%20708%22%3E%3C%2Fsvg%3E\" alt=\"alerts-with-action-defined-for-app\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20589%20708%22%3E%3C%2Fsvg%3E 589w\" sizes=\"(max-width: 589px) 100vw, 589px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/alerts-with-action-defined-for-app.jpg 589w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/alerts-with-action-defined-for-app-249x300.jpg 249w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/alerts-with-action-defined-for-app.jpg\"><\/p>\n<h4><strong>Now lets see how to do it programmatically.<\/strong><\/h4>\n<p class=\"mt20\">From iOS 8 no words register for push notification API has changed the previous one is deprecated.<br>\nTo use Interactive notification actions in application, you first need to register your actions. This involves defining your actions, grouping them into a category and then registering those categories with your user notification settings.<\/p>\n<p>In AppDelegate:<br>\nImplement the method as shown below and call it from &#8220;application:didFinishLaunchingWithOptions:&#8221;<br>\nmethod<\/p>\n<pre class=\"mb40\">NSString * const notificationCategoryIdentifier  = @\"Friend_Request\";\n\nNSString * const notificationActionOneIdentifier = @\"Accept_Action\";\n\nNSString * const notificationActionTwoIdentifier = @\"Reject_Action\";\n\n\n\n- (void)registerForAPNS {\n    \n    if ([[[UIDevice currentDevice] systemVersion] floatValue] &gt;= 8.0)\n    {\n        \n        UIMutableUserNotificationAction *acceptAction;\n        acceptAction = [[UIMutableUserNotificationAction alloc] init];\n        [acceptAction setActivationMode:UIUserNotificationActivationModeBackground];\n        [acceptAction setTitle:@\"Accept\"];\n        [acceptAction setIdentifier:notificationActionOneIdentifier];\n        [acceptAction setDestructive:NO];\n        [acceptAction setAuthenticationRequired:NO];\n        \n        UIMutableUserNotificationAction *rejectAction;\n        rejectAction = [[UIMutableUserNotificationAction alloc] init];\n        [rejectAction setActivationMode:UIUserNotificationActivationModeBackground];\n        [rejectAction setTitle:@\"Reject\"];\n [rejectAction setIdentifier:notificationActionTwoIdentifier];\n        [rejectAction setDestructive:NO];\n        [rejectAction setAuthenticationRequired:NO];\n        \n        UIMutableUserNotificationCategory *actionCategory;\n        actionCategory = [[UIMutableUserNotificationCategory alloc] init];\n        [actionCategory setIdentifier:notificationCategoryIdentifier];\n        \n        [actionCategory setActions:@[acceptAction, rejectAction]\n                        forContext:UIUserNotificationActionContextDefault];\n        \n        NSSet *notificationCategories = [NSSet setWithObject:actionCategory];\n        UIUserNotificationType notificationTypes = (UIUserNotificationTypeAlert|\n                                                    UIUserNotificationTypeSound|\n                                                    UIUserNotificationTypeBadge);\n        \n        UIUserNotificationSettings *settings;\n        settings = [UIUserNotificationSettings settingsForTypes:notificationTypes\n                                                     categories:notificationCategories];\n        \n        [[UIApplication sharedApplication]registerUserNotificationSettings:settings];\n        \n        \n      [[UIApplication sharedApplication]\n       registerForRemoteNotifications];\n        \n    } else {\n        \n        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:\nUIRemoteNotificationTypeAlert|UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound];\n    }\n    \n}\n<\/pre>\n<p>This method will register the App for receiving push notification. Here we have created 2 Actions with identifiers &#8220;Accept_Action&#8221; &amp; &#8220;Reject_Action&#8221; which belong to category identifier &#8220;Friend_Request&#8221;. When the <strong>App receives push payload with category identifier : \u201cFriend_Request\u201d the user will see the respective actions on Locked Screen, Banner, Notification Center &amp; Alert.<\/strong><\/p>\n<ol class=\"iosapp-list\">\n<li><a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/UIKit\/Reference\/UIUserNotificationSettings_class\/index.html\">UIUserNotificationSettings<\/a> : It contains the types of notifications that can be displayed to the user by your app. Eg Alert, Sound, Badge.<\/li>\n<li>UIUserNotificationCategory : It contains information about custom actions that your app can perform in response to a local or push notification.\n<p style=\"margin-bottom: 0;\">Category is a type of notification that your app receives, and depending on the category you show user the configured actions for that category.<\/p>\n<ul class=\"iosapp-list\">\n<li style=\"list-style-type: disc;\"><strong>UIUserNotificationActionContextDefault <\/strong>is used when the notification is displayed as a modal alert <strong>Max 4 actions are Allowed<\/strong> Plus one Open &amp; Close action will be present by default on alert.<\/li>\n<li class=\"mb20\" style=\"list-style-type: disc;\"><strong>UIUserNotificationActionContextMinimal <\/strong>is used when notification is displayed on lock screen, in the notification center and in banner notifications.<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/developer.apple.com\/library\/ios\/documentation\/UIKit\/Reference\/UIUserNotificationAction_class\/index.html\">UIUserNotificationAction<\/a> : Represents a custom action that your app canperform in response to a remote or local notification.\n<ul class=\"iosapp-list\">\n<li class=\"mb20\" style=\"list-style-type: disc;\"><strong>Activation Mode<\/strong>: Can be set to <strong>background <\/strong>or <strong>foreground<\/strong>, which will activate the app in background or foreground once an action is selected by user. If you want to present UI after an action is selected use <strong>foreground (eg. Reply to chat)<\/strong> or use <strong>background (eg. Friend request)<\/strong>, but then you will get little time to complete your action in background.<\/li>\n<li style=\"list-style-type: disc;\"><strong>Destructive<\/strong>: If &#8220;Yes&#8221; <strong>action <\/strong>will be shown as <strong>Red <\/strong>in lock screen and notification center as shown below.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p><noscript><img decoding=\"async\" width=\"692\" height=\"160\" class=\"aligncenter size-full wp-image-6933 img-responsive app-img-border\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/destructive.jpg\" alt=\"destructive\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/destructive.jpg 692w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/destructive-300x69.jpg 300w\" sizes=\"(max-width: 692px) 100vw, 692px\"><\/noscript><img decoding=\"async\" width=\"692\" height=\"160\" class=\"aligncenter size-full wp-image-6933 img-responsive app-img-border lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20692%20160%22%3E%3C%2Fsvg%3E\" alt=\"destructive\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20692%20160%22%3E%3C%2Fsvg%3E 692w\" sizes=\"(max-width: 692px) 100vw, 692px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/destructive.jpg 692w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/destructive-300x69.jpg 300w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/destructive.jpg\"><\/p>\n<ul class=\"iosapp-list\">\n<li><strong>Authentication<\/strong>: If &#8220;Yes&#8221; and device is locked, user will have to enter their passcode when they tap on the action. This is useful when your app activation mode is <strong>background <\/strong>and hitting on action will result in accessing files. <strong>If Activation mode is foreground and device is locked user will have to enter their passcode irrespective of authentication property<\/strong>.<\/li>\n<\/ul>\n<p>To register device to backend server you will need to implement <strong>&#8220;application: didRegisterForRemoteNotificationsWithDeviceToken&#8221;<\/strong><\/p>\n<p>You will need to implement <strong>&#8220;application: didReceiveRemote Notification with fetchCompletionHandler&#8221;<\/strong> to show and handle notification when an app is in foreground because iOS won\u2019t display notification when the app is in foreground.<br>\nThis method will also get called when user tabbed on Notification message and not on Actions.<br>\nFor <strong>silent notification<\/strong> though, this methods gets call <strong>in both cases background or foreground.<\/strong><br>\nTo handle action you will need to implement <strong>&#8220;application:application handleActionWithIdentifier: forRemoteNotification: completionHandler&#8221;<\/strong> Identifier is equal to action which user has tapped.<\/p>\n<h3><strong>Payload for Interactive notification:<\/strong><\/h3>\n<p>Good News Apple has increased Push Payload limit from <strong>256 bytes<\/strong> to<strong> 2 kilobytes<\/strong>.<\/p>\n<pre>{\n\t\"aps\": { \n    \t \"alert\": \"John wants to be Friend with you\",\n\t<strong>  \"category\" : \"Friend_Request\"<\/strong>\n          ...\n\t}\n      ...\n}\n}<\/pre>\n<h3><strong>Now lets see Silent Notification.<\/strong><\/h3>\n<h4><strong>Silent notification:<\/strong><\/h4>\n<p>Is a Remote Notification introduced in iOS 7, which is send silently (i.e without notifying user) to app. This is useful when you need to do image processing and data processing in background and Display user updated data when app comes to foreground. To receive it you will need to set value<\/p>\n<p>In <strong>Project -&gt; Capabilities -&gt; Background Modes -&gt; Remote Notifications<\/strong> &amp; In Plist <strong>Required background modes : App downloads content in response to push notifications<\/strong> in xcode.<\/p>\n<h4><strong>Payload for silent notifications<\/strong><\/h4>\n<pre>{\n   \"aps\": {\n\t\t<strong>\"content-available\": 1,<\/strong>\n\t\t\"sound\" : \"\"\n            ...\n\t}\n    ...\n}\n<\/pre>\n<p>Note: If you use <a href=\"https:\/\/parse.com\/\">Parse<\/a> as a backend then you need to set <strong>&#8220;sound&#8221;<\/strong> : &#8220;&#8221; in payload for silent notifications.<\/p>\n<p>Interactive notifications enable users to take actions on messages, text, reminders, email, and calendar notifications without leaving the app or doing things what they are doing. This feature has added convenience and an ease to users enhancing the entire UX.<\/p>\n<p><a href=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/APNSDemo.zip\" download>Download source code from here.<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If iOS 7 set the standards high by creating one of the finest operating system, iOS 8 took forward the experience in the best possible manner offering immaculate features to users. One of it is \u2018Interactive Notifications\u2019. What is Interactive Notification Interactive Notification allows user to take action on Notification from Locked Screen, Banner &amp; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"","footnotes":""},"categories":[450],"tags":[],"class_list":["post-6920","post","type-post","status-publish","format-standard","hentry","category-mguide"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iOS 8 Interactive Notifications - Mobisoft<\/title>\n<meta name=\"description\" content=\"iOS 8 ushered in an exciting new API for creating interactive notifications thus keeping you focused while you stay in touch.Learn more.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iOS 8 Interactive Notifications - Mobisoft\" \/>\n<meta property=\"og:description\" content=\"iOS 8 ushered in an exciting new API for creating interactive notifications thus keeping you focused while you stay in touch.Learn more.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications\" \/>\n<meta property=\"og:site_name\" content=\"Mobisoft Infotech\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-15T09:38:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-06-12T09:53:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg\" \/>\n<meta name=\"author\" content=\"Pritam Barhate\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pritam Barhate\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#article\",\"isPartOf\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications\"},\"author\":{\"name\":\"Pritam Barhate\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/fa762036b3364f26abeea146c01487ee\"},\"headline\":\"iOS 8 Interactive Notifications\",\"datePublished\":\"2014-12-15T09:38:04+00:00\",\"dateModified\":\"2015-06-12T09:53:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications\"},\"wordCount\":835,\"image\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage\"},\"thumbnailUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg\",\"articleSection\":[\"MGuide\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications\",\"name\":\"iOS 8 Interactive Notifications - Mobisoft\",\"isPartOf\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage\"},\"image\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage\"},\"thumbnailUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg\",\"datePublished\":\"2014-12-15T09:38:04+00:00\",\"dateModified\":\"2015-06-12T09:53:16+00:00\",\"author\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/fa762036b3364f26abeea146c01487ee\"},\"description\":\"iOS 8 ushered in an exciting new API for creating interactive notifications thus keeping you focused while you stay in touch.Learn more.\",\"breadcrumb\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg\",\"contentUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg\",\"width\":606,\"height\":504},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mobisoftinfotech.com\/resources\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iOS 8 Interactive Notifications\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#website\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/\",\"name\":\"Mobisoft Infotech\",\"description\":\"Discover Mobility\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mobisoftinfotech.com\/resources\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/fa762036b3364f26abeea146c01487ee\",\"name\":\"Pritam Barhate\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0e481c7ce54b3567ac70ddfc493523eefce0bdc3ee69fd2654f8f60a79e2f178?s=96&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0e481c7ce54b3567ac70ddfc493523eefce0bdc3ee69fd2654f8f60a79e2f178?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0e481c7ce54b3567ac70ddfc493523eefce0bdc3ee69fd2654f8f60a79e2f178?s=96&r=g\",\"caption\":\"Pritam Barhate\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iOS 8 Interactive Notifications - Mobisoft","description":"iOS 8 ushered in an exciting new API for creating interactive notifications thus keeping you focused while you stay in touch.Learn more.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications","og_locale":"en_US","og_type":"article","og_title":"iOS 8 Interactive Notifications - Mobisoft","og_description":"iOS 8 ushered in an exciting new API for creating interactive notifications thus keeping you focused while you stay in touch.Learn more.","og_url":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications","og_site_name":"Mobisoft Infotech","article_published_time":"2014-12-15T09:38:04+00:00","article_modified_time":"2015-06-12T09:53:16+00:00","og_image":[{"url":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg","type":"","width":"","height":""}],"author":"Pritam Barhate","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Pritam Barhate","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#article","isPartOf":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications"},"author":{"name":"Pritam Barhate","@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/fa762036b3364f26abeea146c01487ee"},"headline":"iOS 8 Interactive Notifications","datePublished":"2014-12-15T09:38:04+00:00","dateModified":"2015-06-12T09:53:16+00:00","mainEntityOfPage":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications"},"wordCount":835,"image":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage"},"thumbnailUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg","articleSection":["MGuide"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications","url":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications","name":"iOS 8 Interactive Notifications - Mobisoft","isPartOf":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage"},"image":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage"},"thumbnailUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg","datePublished":"2014-12-15T09:38:04+00:00","dateModified":"2015-06-12T09:53:16+00:00","author":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/fa762036b3364f26abeea146c01487ee"},"description":"iOS 8 ushered in an exciting new API for creating interactive notifications thus keeping you focused while you stay in touch.Learn more.","breadcrumb":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#primaryimage","url":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg","contentUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2014\/12\/locked-screen.jpg","width":606,"height":504},{"@type":"BreadcrumbList","@id":"https:\/\/mobisoftinfotech.com\/resources\/mguide\/ios-8-interactive-notifications#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mobisoftinfotech.com\/resources\/"},{"@type":"ListItem","position":2,"name":"iOS 8 Interactive Notifications"}]},{"@type":"WebSite","@id":"https:\/\/mobisoftinfotech.com\/resources\/#website","url":"https:\/\/mobisoftinfotech.com\/resources\/","name":"Mobisoft Infotech","description":"Discover Mobility","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mobisoftinfotech.com\/resources\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/fa762036b3364f26abeea146c01487ee","name":"Pritam Barhate","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0e481c7ce54b3567ac70ddfc493523eefce0bdc3ee69fd2654f8f60a79e2f178?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0e481c7ce54b3567ac70ddfc493523eefce0bdc3ee69fd2654f8f60a79e2f178?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0e481c7ce54b3567ac70ddfc493523eefce0bdc3ee69fd2654f8f60a79e2f178?s=96&r=g","caption":"Pritam Barhate"}}]}},"_links":{"self":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/6920","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/comments?post=6920"}],"version-history":[{"count":25,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/6920\/revisions"}],"predecessor-version":[{"id":7869,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/6920\/revisions\/7869"}],"wp:attachment":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/media?parent=6920"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/categories?post=6920"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/tags?post=6920"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}