iosnotificationsactionapplication-lifecycleusernotifications

iOS 10 UNNotificationAction Open App from Background


How can I open my app, when user receive notification and my app was in background? Of course tap on notification itself would open app, but how to handle it with custom notification action?

I have implemented UNUserNotificationCenterDelegate and userNotificationCenter(_, didReceive, ...) already

Just need a code which would open my app and do specific action (for example go to specific view)

It would be nice if notification handler recognise that notification and open iPhone app or Apple Watch app depends on where action was tapped..


Solution

  • Ok i have found the solution. We have to set UNNotificationActionOptions :)

    UNNotificationActionOptions.foreground