Responding to Notification

When your app is not running or is in the background, the system automatically delivers local and remote notifications using the interactions you specified. If your app is running in the foreground, notifications are delivered directly to your app. You can then decide whether to handle the notification quietly or alert the user.

To respond to the delivery of notifications, you must subscribe to the ISN_UNUserNotificationCenterDelegate events.

WillPresentNotification event called when a notification is delivered to a foreground app. If your app is in the foreground when a notification arrives,  the notification center calls this method to deliver the notification directly to your app. If you implement this method, you can take whatever actions are necessary to process the notification and update your app. User will not be alreated by a system.

using SA.IOSNative.UserNotifications;
...
ISN_UNUserNotificationCenterDelegate.WillPresentNotification.AddListener((ISN_UNNotification notification) => {
    //Do something
});

The notification will be represented as the  ISN_UNNotification object

Handling Notifications When Your App Is in not running

If the user clicked on notification generated by your app, the application will be launched. There is a way to find out for you if your app was launched by notification click. You should LastReceivedResponse property of ISN_UNUserNotificationCenterDelegate, as soon as the application is started. If LastReceivedResponse contains the ISN_UNNotificationResponse object,  means your app was launched with a user clicking the notification. So you can act accordingly.

using SA.IOSNative.UserNotifications;
...
var notificationResponse = ISN_UNUserNotificationCenterDelegate.LastReceivedResponse;