Blueshift Push Notifications Settings

The SDK supports rendering of simple, interactive and rich push notifications. The push notification framework supports custom landing pages, call to action buttons (view/buy) and images, gif, audio, video in iOS version 10 and above. In addition, it also supports alert box notifications.

The application can override this notification framework by implementing its own notification rendering methods. If the application override the framework, it is important to call/implement the notification events to ensure accurate reporting. Below is an overview of the methods the application should override to implement its own notification framework.

 

Accessing BlueShift Notification Settings

If iOS app want to override default BlueShift SDK push notification registration or want to send custom push notification from other notification servers along with BlueShift notification, import the BlueShift notification settings or categories and mutate with your own custom notification settings and register it

For getting BlueShift notification settings:

UIUserNotificationSettings* notificationSettings = [[[BlueShift sharedInstance] pushNotification] notificationSettings];
[[UIApplication sharedApplication] registerUserNotificationSettings: notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

For getting BlueShift notification categories and notification types:

NSSet *categories = [[[BlueShift sharedInstance] pushNotification] notificationCategories];
UIUserNotificationType types = [[[BlueShift sharedInstance] pushNotification] notificationTypes];
UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:types categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings: notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

If you need your own categories along with BlueShift categories append inside categories set.

For getting required BlueShift push notification categories:

UIMutableUserNotificationCategory *viewCartCategory = [[[BlueShift sharedInstance] pushNotification] viewCartCategory];
UIMutableUserNotificationCategory *buyCategory = [[[BlueShift sharedInstance] pushNotification] buyCategory];
UIMutableUserNotificationCategory *oneButtonAlertCategory = [[[BlueShift sharedInstance] pushNotification] oneButtonAlertCategory];
UIMutableUserNotificationCategory *twoButtonAlertCategory = [[[BlueShift sharedInstance] pushNotification] twoButtonAlertCategory];
UIMutableUserNotificationCategory *carouselCategory = [[[BlueShift sharedInstance] pushNotification] carouselCategory];
UIMutableUserNotificationCategory *carouselAnimationCategory = [[[BlueShift sharedInstance] pushNotification] carouselAnimationCategory];

NSSet *categories = [NSSet setWithObjects:buyCategory, viewCartCategory, oneButtonAlertCategory, twoButtonAlertCategory, carouselCategory, carouselAnimationCategory, nil];
UIUserNotificationType types = [[[BlueShift sharedInstance] pushNotification] notificationTypes];
UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:types categories:categories];
[[UIApplication sharedApplication] registerUserNotificationSettings: notificationSettings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

If you need your own categories along with BlueShift categories append inside categories set. 

 

1. Override Register Remote Notification

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
      [[BlueShift sharedInstance].appDelegate registerForRemoteNotification:deviceToken];
      // Custom Code Here
}
  

2. Override Notification Action Delegate

- (void)application:(UIApplication *) application handleActionWithIdentifier: (NSString *) identifier    forRemoteNotification: (NSDictionary *) notification completionHandler: (void (^)()) completionHandler {
}
  

3. Override Notification Foreground and Background Fetching Delegate

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler {
}
Was this article helpful?
0 out of 0 found this helpful