Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Notification Content Extension is an extension to your app which provides a custom interface to your notification in the notification center.
Content extensions provide a great user experience because they’re integrated with the notification center and it runs in a process independent of the main process. However, it is mandatory for the main application to receive feedback when displaying the content extension. In this blog, we will discuss how to create a content extension.
Create a Content Extension:
Add a Notification Content Extension target to your application by selecting File -> New -> Target, and then selecting the Notification Content Extension icon in the Application Extension section as follow:
Notification Content Extension
Application Extension
The extension that is created contains a NotificationViewController that adheres to the UNNotificationContentExtension.
NotificationViewController
UNNotificationContentExtension
If a UIViewController inside a Notification Content Extension adheres to the UNNotificationContentExtension, we are able to access the notification content and we can customize its UI. In the extension, there’s a MainInterface.storyboard that contains a single controller associated with the NotificationViewController previously mentioned. We can use this storyboard to customize the notification UI using an interface builder.
We can change the UI with the notification contents we receive in func didReceive(_ notification: UNNotification).Your code will look like below:
didReceive(_ notification: UNNotification)
Now we have to go back to our notification content extension and set some attributes in its info.plist. In particular, we have to set:
UNNotificationExtensionCategory
UNNotificationExtensionDefaultContentHidden
We’re ready to test our implementation.
Conclusion:
That’s all for Notification Content App Extension on iOS. Let’s start to test them in your app. To read more of my blogs, please visit this link. Thank you for reading this blog.
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
Name
Email
Subject
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.