Notification Center
Notification Center Screen
If you want to use Smartech's notification center then you need to call a screen and you can see all the notifications on that screen.
SmartechNotificationCenterVC *smtNotificationCenterVC = [[UIStoryboard storyboardWithName:@"SmartechNC" bundle:nil] instantiateViewControllerWithIdentifier:@"SmartechNotificationCenterVC"];
[self.navigationController pushViewController:smtNotificationCenterVC animated:YES];
let smtNotificationCenterVC = UIStoryboard(name: "SmartechNC", bundle: nil).instantiateViewController(withIdentifier: "SmartechNotificationCenterVC") as! SmartechNotificationCenterVC
self.navigationController!.pushViewController(smtNotificationCenterVC, animated: true)
Fetch Delivered Push Notifications
If you want to create your own notification center to display all the delivered notification from Smartech to the user's device, you can call a method named getNotifications which will return all of the notification payloads delivered by Smartech in NSArray.
NSMutableArray <NCNotification*> *notifications = [[NCNotification getNotifications] mutableCopy];
var notifications : [NCNotification] = NCNotification.getNotifications()
If you need a certain number of notification payloads then you can call a method named getNotificationsWithCount.
NSArray <NCNotification*> *notifications = [[NCNotification getNotificationsWithCount:10]];
var notifications : [NCNotification] = NCNotification.getNotificationsWithCount(10)
Fetch Unread Push Notification Count
To fetch unread push notification count from the NetcoreSDK, you can call the following method:
NSUInteger unreadCount = [NCNotification getUnreadNotificationsCount];
let unreadCount = NCNotification.getUnreadNotificationsCount()
Identify Smartech Notifications
If in case you are using multiple vendors for push notifications and you want to identify that the notification is received from Smartech then you can use a method name 'isNotificationFromNetCore'. This method takes notification payload in parameter and returns true if notification is from Smartech.
if [[NetCorePushTaskManager sharedInstance] isNotificationFromNetCore:(nonnull NSDictionary *)] {
}
if NetCorePushTaskManager.sharedInstance().isNotification(fromNetCore:[AnyHashable : Any]) {
}
Updated about 4 years ago