Santosh Kumar Dwivedi Santosh Kumar Dwivedi - 1 year ago 100
iOS Question

Changing action titles in interactive notifications at run time

As per my understanding I have to register categories and actions therein for local or remote interactive notifications, now my requirement is that I want to show buttons with dynamic titles coming as part of the push payload.

As an alternative I have also tried the option of firing a local notification with settings registered when a remote notification is received, but somehow it is not working and the local notification is not fired. Help highly appreciated.

Answer Source

The short answer is that you can't change the action button title at runtime.

BUT, you can try the following:

  1. Before sending a notification to the device, send it a "silent" notification, using the content-available property. In this notification, send a data which represent your new action button titles.

  2. Update your relevant category using registerUserNotificationSettings:.

  3. Send the "real" notification with the new action titles, you've just created.

It need to be tested, as I never tried it in a production mode. Also, take into consideration, that you're going to double up your notification sent amount.

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