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.
Actionable notifications are a unique type of notification as they allow the user to add buttons to the notification which can then send an event to Home Assistant once clicked.
It's the same process as setting up for Notification Service Extension. Go to xcode select File > New > Target > Notification Content Extension > Next > Product Name( name it as CustomUI) > Finish > Active scheme popUp(if comes then select cancel). Every Custom UI must have its unique category Identifier.
Rich push notifications are short pop-up messages sent to a user's device with a rich media attachment such as an animated GIF, video, or audio. They allow you to communicate with your customers in an inviting way even when they're not actively using your app or visiting your website.
The short answer is that you can't change the action button title at runtime.
BUT, you can try the following:
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.
Update your relevant category using registerUserNotificationSettings:
.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With