These docs are for v1.0. Click to read the latest docs for v2.0.

Configuring Extensions with Smartech SDK

Configuring Service Extension

You need to add the following changes in the Notification Service Extension's implementation file. NotificationService.m

#import "NotificationService.h"
#import <NetCorePush/NetCorePush.h>

@interface NotificationService ()

@end

@implementation NotificationService

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
    
    [[NetCoreNotificationService sharedInstance] setUpAppGroup:@"<USE_SAME_APPGROUP_USED_IN_APPDELEGATE>"];
    
    [[NetCoreNotificationService sharedInstance] didReceiveNotificationRequest:request withContentHandler:^(UNNotificationContent *contentToDeliver) {
        contentHandler(contentToDeliver);
    }];
}

- (void)serviceExtensionTimeWillExpire {
    
    [[NetCoreNotificationService sharedInstance] serviceExtensionTimeWillExpire];
}

@end
import UserNotifications
import NetCorePush

class NotificationService: UNNotificationServiceExtension {

    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
        
        NetCoreNotificationService.sharedInstance().setUpAppGroup("<USE_SAME_APPGROUP_USED_IN_APPDELEGATE>")
        NetCoreNotificationService.sharedInstance().didReceive(request) { (contentToDeliver:UNNotificationContent) in
            contentHandler(contentToDeliver)
        }
    }
    
    override func serviceExtensionTimeWillExpire() {
        NetCoreNotificationService.sharedInstance().serviceExtensionTimeWillExpire()
    }

}

Configuring Content Extension

For Objective-C Project replace the following files from the file provided in Rich Files\ObjC Folder:

  1. MainInterface.storyboard
  2. NotificationViewController.h
  3. NotificationViewController.m

For Swift Project replace the following files from the file provided in Rich Files\Swift Folder:

  1. MainInterface.storyboard
  2. NotificationViewController.swift

In your Content Extensions Info.plist under NSExtension -> NSExtensionAttributes

  1. Replace the UNNotificationExtensionCategory value with String value smartechPushCategory
  2. Add the UNNotificationExtensionDefaultContentHidden key with Boolean value NO.