kony.notificationContentExtension Namespace
The kony.notificationContentExtension Namespace enables you to add support for Notification Content app extensions in your iOS app. With Notification Content app extensions, your app can display a custom user interface for its notifications. For more information about what Notification Content app extensions are and what you can use them for, refer the Apple developer documentation.
You can add a Notification Content extension to your app in the same way that you add any other type of iOS app extension. For more details, refer App Extension for iOS.
Before your Notification Content extension can be used, your app must set the callback functions that provide the Notification Content app extension with its functionality. It does this by invoking the kony.notificationContentExtension.setExtensionsCallbacks function.
Properties
The kony.notificationContentExtension Namespace contains the following properties.
Holds the current extension view.
Syntax
kony.notificationContentExtension.view;
Example
//Sample code
var myView = kony.notificationContentExtension.view; myView.addSubView(button);
Type
UIView
Read/Write
Read only
Platform Availability
iOS
Functions
The kony.notificationContentExtension Namespace provides the following function.
Sets a notification content extension with various states as callback events.
Syntax
kony.notificationContentExtension.setExtensionsCallbacks(
callbacks);
Input Parameters
callbacks
Contains an object with key-value pairs where the key specifies the extension state and the value is a callback function. The following are the possible keys.
Key | Description |
---|---|
didReceiveNotification | The app received a notification. |
didReceiveNotificationResponse | The user tapped one of the notification's actions. |
loadView | Loads a view that the controller manages. |
viewDidAppear | A view was just displayed. |
viewDidDisappear | A view just removed from the view hierarchy. |
viewDidLoad | The controller has loaded its view hierarchy into memory. |
viewWillAppear | A view is about to be displayed. |
viewWillDisappear | A view is about to be removed from the view hierarchy. |
Example: didReceiveNotification
function didReceiveNotification() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "didReceiveNotification": didReceiveNotification });
Example: didReceiveNotificationResponse
function didReceiveNotificationResponse() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "didReceiveNotificationResponse": didReceiveNotificationResponse });
Example: loadView
function loadView() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "loadView": loadView });
Example: viewDidAppear
function viewDidAppear() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "viewDidAppear": viewDidAppear });
Example : viewDidLoad
function viewDidLoad() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "viewDidLoad": viewDidLoad });
Example: viewWillAppear
function viewWillAppear() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "viewWillAppear": viewWillAppear });
Example: viewDidDisappear
function viewDidDisappear() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "viewDidDisappear": viewDidDisappear });
Example: viewWillDisappear
function viewWillDisappear() { // Native Function API code } kony.notificationContentExtension.setExtensionsCallbacks({ "viewWillDisappear": viewWillDisappear });
Return Values
None
Platform Availability
iOS