Working with interactive Push Notifications
Users need to interact with Push Notifications by performing actions, such as tapping on it to see what are you telling them or swiping the notification to see multiple actions customized only for your app. If the app is in the foreground and the app received the Push Notification, the push notification will not be shown. However, in iOS 10, the UserNotifications
framework has provided a way to make it presentable. If the app is in the background and the user received the push notification for your app, the push notification message will be presented. Clicking on the Push Notification will automatically open your app. Swiping on the notification will show two actions, by default. The View action is to open the app and the Clear action is to clear the notification from the notification center.
In this section, we will see how to handle tapping on the notification and how to customize the default actions of the notification.
How to do it...
Open the...