Becoming UNUserNotificationCenterDelegate requires forwarding data to iOS SDK.
Notification Delegate: If you choose to become UNUserNotificationCenterDelegate, it will require you to forward its delegate methods to SDK:
Note |
---|
Note that after becoming UNUserNotificationCenterDelegate, SDK will only take over after application launch from a killed state. |
Code Blockexpand |
---|
title | Forwarding calls - ObjCiOS [Objective-C] |
---|
|
Code Block |
---|
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler __IOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0) __TVOS_PROHIBITED
{
[[Appoxee shared] userNotificationCenter:center didReceiveNotificationResponse:response withAppoxeeCompletionHandler:^{
// When the completion handler is called, this means that Appoxee completed it's execution.
// Call the completion handler.
completionHandler();
}];
} |
|
Code Blockexpand |
---|
title | Forwarding calls - Swift |
---|
| |
Code Block |
---|
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
Appoxee.shared()?.userNotificationCenter(center, didReceive: response, withAppoxeeCompletionHandler: {
// When the completion handler is called, this means that Appoxee completed it's execution.
// Call the completion handler.
completionHandler()
})
} |
|
And to control the display of notifications in the foreground by yourself.
Code Blockexpand |
---|
title | Foreground notifications - ObjCiOS [Objective-C] |
---|
|
Code Block |
---|
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler __IOS_AVAILABLE(10.0) __TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
{
// Choose to display, or not display notifications on foreground.
completionHandler(UNNotificationPresentationOptionNone);
} |
|
Code Blockexpand |
---|
title | Foreground notifications - Swift |
---|
| |
Code Block |
---|
@available(iOS 10.0, *)
private func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void) {
// Choose to display, or not display notifications on foreground.
completionHandler([])
} |
|