Handling Push Notification Click Events in iOS with Netmera SDK
Netmera SDK automatically collects Click Push Events, allowing you to track when users interact with notifications. However, if you experience issues with collecting these events, it’s important to ensure that your app is properly configured to handle them.
Implementing UNUserNotificationCenter Delegate
Set up the UNUserNotificationCenter.delegate at the beginning of the didFinishLaunchingWithOptions method in your AppDelegate file.
// In didFinishLaunchingWithOptions (AppDelegate.swift)
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
} else {
// Fallback on earlier versions
}
// In didFinishLaunchingWithOptions (AppDelegate.m)
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
Handle Push Notification Click Events
Once you’ve set the delegate, Netmera will automatically handle push notification events, including click events. Below are the methods to process push notification click events.
To capture push notifications when the app is in the background or foreground, you can implement the following methods. This method will return latest push object received by device.