pcg26 pcg26 - 1 year ago 70
Swift Question

Action button show app on foreground

If I tap the notification, it will open the app, but when I add button to the notification, and the user press a button the app stay on background, I want the same operation as tap on the notification (open the app on frontend)

Its possible?

Solved! Thanks for the answer:

let actionButton = UIMutableUserNotificationAction()
actionButton.identifier = identifier
actionButton.title = title
actionButton.activationMode = UIUserNotificationActivationMode.Foreground
actionButton.authenticationRequired = true
actionButton.destructive = false

Answer Source

Set activationMode of your action to UIUserNotificationActivationModeForeground if you want the app to be opened by that action.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download