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.
NSArray *notificationArray = [[Smartech sharedInstance] getNotifications];
let notificationArray = Smartech.sharedInstance().getNotifications()
If you need a certain number of notification payloads then you can call a method named getNotificationsWithCount.
NSArray *notificationArray = [[Smartech sharedInstance] getNotificationsWithCount:10];
let notificationArray = Smartech.sharedInstance().getNotificationsWithCount(10)
Fetch Unread Push Notification Count
To fetch unread push notification count from the NetcoreSDK, you can call the following method:
NSInteger unreadCount = [[Smartech sharedInstance] getUnreadNotificationsCount];
let unreadCount = Smartech.sharedInstance().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 'isNotificationfromSmartech'. This method takes notification payload in parameter and returns true if notification is from Smartech.
if ([[Smartech sharedInstance] isNotificationFromSmartech:userInfo]) {
}
if Smartech.sharedInstance().isNotification(fromSmartech: userInfo) {
}
Updated over 4 years ago